### Basic Usage of changed-files Action Source: https://github.com/tj-actions/changed-files/blob/main/README.md This snippet shows the basic setup for using the tj-actions/changed-files action. It includes the action reference and an example of how to assign an ID to the step. ```yaml - uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 id: changed-files with: # Github API URL. # Type: string # Default: "${{ github.api_url }}" api_url: '' # Specify a different base commit # SHA or branch used for # comparing changes # Type: string base_sha: '' # Exclude changes outside the current # directory and show path names # relative to it. NOTE: This # requires you to specify the # top-level directory via the `path` # input. # Type: boolean # Default: "true" diff_relative: '' # Output unique changed directories instead # of filenames. NOTE: This returns # `.` for changed files located # in the current working directory # which defaults to `$GITHUB_WORKSPACE`. # Type: boolean # Default: "false" dir_names: '' # Include only directories that have # been deleted as opposed to # directory names of files that # have been deleted in the # `deleted_files` output when `dir_names` is # set to `true`. # Type: boolean # Default: "false" dir_names_deleted_files_include_only_deleted_dirs: '' # Exclude the current directory represented # by `.` from the output # when `dir_names` is set to # `true`. # Type: boolean # Default: "false" dir_names_exclude_current_dir: '' # File and directory patterns to # include in the output when # `dir_names` is set to `true`. # NOTE: This returns only the # matching files and also the # directory names. # Type: string dir_names_include_files: '' # Separator used to split the # `dir_names_include_files` input # Type: string # Default: "\n" dir_names_include_files_separator: '' # Limit the directory output to # a maximum depth e.g `test/test1/test2` # with max depth of `2` # returns `test/test1`. # Type: string dir_names_max_depth: '' # Escape JSON output. # Type: boolean # Default: "true" escape_json: '' # Exclude changes to submodules. # Type: boolean # Default: "false" exclude_submodules: '' # Exclude symlinks from changed files. # Type: boolean # Default: "false" exclude_symlinks: '' # Fail when the initial diff # fails. # Type: boolean # Default: "false" fail_on_initial_diff_error: '' # Fail when the submodule diff # fails. # Type: boolean # Default: "false" fail_on_submodule_diff_error: '' # Fetch additional history for submodules. # Type: boolean # Default: "false" fetch_additional_submodule_history: '' # Depth of additional branch history # fetched. NOTE: This can be # adjusted to resolve errors with # insufficient history. # Type: string # Default: "25" fetch_depth: '' # Maximum number of retries to # fetch missing history. # Type: string # Default: "20" fetch_missing_history_max_retries: '' # File and directory patterns used # to detect changes (Defaults to the entire repo if unset). NOTE: # Multiline file/directory patterns should not # include quotes. # Type: string files: '' # Source file(s) used to populate # the `files` input. # Type: string files_from_source_file: '' # Separator used to split the # `files_from_source_file` input. # Type: string # Default: "\n" files_from_source_file_separator: '' # Ignore changes to these file(s). # NOTE: Multiline file/directory patterns should # not include quotes. # Type: string files_ignore: '' # Source file(s) used to populate # the `files_ignore` input # Type: string files_ignore_from_source_file: '' # Separator used to split the # `files_ignore_from_source_file` input # Type: string # Default: "\n" files_ignore_from_source_file_separator: '' # Separator used to split the # `files_ignore` input # Type: string # Default: "\n" files_ignore_separator: '' # YAML used to define a # set of file patterns to # ignore changes # Type: string files_ignore_yaml: '' # Source file(s) used to populate # the `files_ignore_yaml` input. Example: https://github.com/tj-actions/changed-files/blob/main/test/changed-files.yml # Type: string files_ignore_yaml_from_source_file: '' # Separator used to split the # `files_ignore_yaml_from_source_file` input # Type: string # Default: "\n" files_ignore_yaml_from_source_file_separator: '' # Separator used to split the # `files` input # Type: string # Default: "\n" files_separator: '' # YAML used to define a # set of file patterns to # detect changes # Type: string ``` -------------------------------- ### List Added Files Example Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md This example demonstrates how to list added files using the 'added_files' output, conditional on 'any_added' being true. ```yaml - name: List added files if: steps.changed-files.outputs.any_added == 'true' run: echo "Added files: ${{ steps.changed-files.outputs.added_files }}" ``` -------------------------------- ### Example: Displaying All Changes Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md This example demonstrates how to access and display various file change outputs like added, modified, deleted files, and the total count of changed files. ```yaml steps: - uses: tj-actions/changed-files@main id: changed-files - run: | echo "Added: ${{ steps.changed-files.outputs.added_files }}" echo "Modified: ${{ steps.changed-files.outputs.modified_files }}" echo "Deleted: ${{ steps.changed-files.outputs.deleted_files }}" echo "Total changed: ${{ steps.changed-files.outputs.all_changed_files_count }}" ``` -------------------------------- ### Example: Conditional Steps Based on File Changes Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md This example shows how to use outputs like `all_changed_files` and `any_changed` to conditionally execute subsequent steps in a GitHub Actions workflow. ```yaml steps: - uses: tj-actions/changed-files@main id: changed-files with: files: | src/** tests/** - name: Run tests if test files changed if: contains(steps.changed-files.outputs.all_changed_files, 'tests/') run: npm test - name: Build if source files changed if: steps.changed-files.outputs.any_changed == 'true' run: npm run build ``` -------------------------------- ### Example: Using YAML Group Outputs Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md This example illustrates how to configure `files_yaml` to define groups and then use the generated group-specific outputs (e.g., `docs_any_changed`, `changed_keys`) to control workflow steps. ```yaml steps: - uses: tj-actions/changed-files@main id: changed-files with: files_yaml: | docs: - '**.md' - docs/** src: - src/** tests: - test/** - name: Run docs checks if: steps.changed-files.outputs.docs_any_changed == 'true' run: npm run docs:check - name: Run tests if: steps.changed-files.outputs.tests_any_changed == 'true' run: npm test - name: Report changed groups run: | echo "Groups with changes: ${{ steps.changed-files.outputs.changed_keys }}" ``` -------------------------------- ### verifyMinimumGitVersion() Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Verifies that the installed Git version meets the minimum requirement of 2.18.0. Throws an error if Git is not installed or the version is insufficient. ```APIDOC ## verifyMinimumGitVersion() ### Description Verifies that the installed Git version meets the minimum requirement of 2.18.0. Throws an error if Git is not installed or the version is insufficient. ### Method `async` ### Parameters None ### Throws Error if git is not installed or version is below 2.18.0 ``` -------------------------------- ### Usage Example for GitHub Actions Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/main.md This example shows how the `run` function is typically called within a GitHub Actions environment. It includes basic error handling and process exit logic. ```typescript import {run} from './main' // Called automatically by GitHub Actions // No direct usage needed in most cases run().catch(error => { console.error('Action failed:', error.message) process.exit(1) }) ``` -------------------------------- ### Example: Space-Separated List Format for Renamed Files Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md Illustrates the default output format for renamed files, which is a space-separated string of old and new paths. ```text oldPath1,newPath1 oldPath2,newPath2 ``` -------------------------------- ### Verify Minimum Git Version Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Checks if the installed Git version meets the minimum requirement of 2.18.0. Throws an error if Git is not installed or the version is too low. ```typescript export async function verifyMinimumGitVersion(): Promise ``` -------------------------------- ### String Format Output Example Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md Files are separated by the 'separator' input, which defaults to a space. This is the default output format. ```shell ${{ steps.changed-files.outputs.added_files }} # Example: src/file1.ts src/file2.ts src/file3.ts ``` -------------------------------- ### ChangedFiles Example Structure Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/types.md Illustrates the expected structure of a ChangedFiles object, showing arrays of file paths for different change types. ```typescript { 'A': ['src/new-file.ts', 'src/components/Button.tsx'], 'M': ['README.md', 'src/utils.ts'], 'D': ['src/old-file.ts'], 'R': ['src/renamed-component.tsx'], 'C': [], 'T': [], 'U': [], 'X': [] } ``` -------------------------------- ### TypeScript Example: getChangeTypeFiles Usage Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/changedFiles.md Demonstrates how to use getChangeTypeFiles to retrieve added files. The result is formatted as a space-separated string. ```typescript const result = await getChangeTypeFiles({ inputs: {json: false, separator: ' ', ...}, changedFiles: {A: ['file1.ts', 'file2.ts'], M: [], ...}, changeTypes: [ChangeTypeEnum.Added] }) // Returns: {paths: 'file1.ts file2.ts', count: '2'} ``` -------------------------------- ### Example: JSON Array Format for Changed Keys Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md Displays the output format for `changed_keys` when it is configured to return a JSON array, listing YAML keys that have associated changes. ```json ["frontend", "backend"] ``` -------------------------------- ### Example: Boolean Output Usage in Conditionals Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md Demonstrates the correct way to use string-based boolean outputs (e.g., `'true'`, `'false'`) in GitHub Actions `if` conditions. ```yaml if: steps.changed-files.outputs.any_changed == 'true' ``` -------------------------------- ### Write changed files outputs to a JSON file Source: https://github.com/tj-actions/changed-files/blob/main/README.md This example demonstrates enabling JSON output and writing the action's results to .json files in the .github/outputs directory. ```yaml ... - name: Get changed files and write the outputs to a JSON file id: changed-files-write-output-files-json uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 with: json: true write_output_files: true - name: Verify the contents of the .github/outputs/added_files.json file run: | cat .github/outputs/added_files.json ... ``` -------------------------------- ### Get all changed files with a comma separator Source: https://github.com/tj-actions/changed-files/blob/main/README.md Configure the action to use a comma as a separator for the output files. ```yaml ... - name: Get all changed files and use a comma separator in the output id: changed-files uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 with: separator: "," ... ``` -------------------------------- ### Get Changed Files from Source File and Specify More Files Source: https://github.com/tj-actions/changed-files/blob/main/README.md Combines using a source file with explicitly listing additional files to track. This allows for flexible file selection. ```yaml - name: Get changed files using a source file or list of file(s) to populate to files input and optionally specify more files. id: changed-files-specific-source-file-and-specify-files uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 with: files_from_source_file: | test/changed-files-list.txt files: | test.txt ``` -------------------------------- ### JSON Format Output Example Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md When 'json: true' is set, files are output as a JSON array. If 'escape_json: true' (default), quotes are escaped for shell use. ```shell ${{ steps.changed-files.outputs.added_files }} # Example: ["src/file1.ts","src/file2.ts","src/file3.ts"] # With escaping: "[\"src/file1.ts\",\"src/file2.ts\",\"src/file3.ts\"]" ``` -------------------------------- ### Example: JSON Array Format for Renamed Files Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md Shows how to configure the action to output renamed files in a JSON array format, where each element is a string representing the old and new path. ```json ["oldPath1,newPath1", "oldPath2,newPath2"] ``` -------------------------------- ### Get all changed files in the current branch Source: https://github.com/tj-actions/changed-files/blob/main/README.md This snippet shows the basic usage of the action to get all changed files. ```yaml ... - name: Get changed files id: changed-files uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 ... ``` -------------------------------- ### Get Submodule Diff SHA Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Gets the commit SHAs of a submodule between two parent commits. Useful for tracking submodule changes. ```typescript export async function gitSubmoduleDiffSHA({ cwd, parentSha1, parentSha2, submodulePath, diff }: { cwd: string parentSha1: string parentSha2: string submodulePath: string diff: string }): Promise<{previousSha?: string; currentSha?: string}> ``` -------------------------------- ### Get All Changed Files Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Executes git diff to get all changed files between two commits. Supports submodules and options for handling renamed files and diff errors. ```typescript export async function getAllChangedFiles({ cwd, sha1, sha2, diff, isSubmodule = false, parentDir = '', outputRenamedFilesAsDeletedAndAdded = false, failOnInitialDiffError = false, failOnSubmoduleDiffError = false }: { cwd: string sha1: string sha2: string diff: string isSubmodule?: boolean parentDir?: string outputRenamedFilesAsDeletedAndAdded?: boolean failOnInitialDiffError?: boolean failOnSubmoduleDiffError?: boolean }): Promise ``` -------------------------------- ### Get Renamed Files Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Gets renamed files between two commits, returning an array of 'old,new' pairs. Requires git diff information and optionally handles submodules. ```typescript export async function gitRenamedFiles({ cwd, sha1, sha2, diff, oldNewSeparator, isSubmodule = false, parentDir = '' }: { cwd: string sha1: string sha2: string diff: string oldNewSeparator: string isSubmodule?: boolean parentDir?: string }): Promise ``` -------------------------------- ### Write changed files outputs to a TXT file Source: https://github.com/tj-actions/changed-files/blob/main/README.md This example shows how to enable writing the action's outputs (added, modified, deleted files) to .txt files in the .github/outputs directory. ```yaml ... - name: Get changed files and write the outputs to a Txt file id: changed-files-write-output-files-txt uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 with: write_output_files: true - name: Verify the contents of the .github/outputs/added_files.txt file run: | cat .github/outputs/added_files.txt ... ``` -------------------------------- ### Using Count-Based Outputs Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md This example shows how to utilize count-based outputs from the changed-files action to summarize the number of added, modified, and deleted files. It also includes a check for any deleted files. ```yaml steps: - uses: tj-actions/changed-files@main id: changed-files - name: Summarize changes run: | echo "Summary of changes:" echo " Added: ${{ steps.changed-files.outputs.added_files_count }}" echo " Modified: ${{ steps.changed-files.outputs.modified_files_count }}" echo " Deleted: ${{ steps.changed-files.outputs.deleted_files_count }}" echo " Total: ${{ steps.changed-files.outputs.all_changed_files_count }}" if [ "${{ steps.changed-files.outputs.any_deleted }}" = "true" ]; then echo "Warning: Some files were deleted" fi ``` -------------------------------- ### Get Changed Files on Pull Request Source: https://github.com/tj-actions/changed-files/blob/main/README.md Use this snippet for pull_request events to get all changed files. It's limited to 3000 files and requires read permissions for pull requests. ```yaml name: CI on: pull_request: branches: - main merge_group: jobs: # ------------------------------------------------------------- # Event `pull_request`: Returns all changed pull request files. # -------------------------------------------------------------- changed_files: # NOTE: # - This is limited to pull_request* events and would raise an error for other events. # - A maximum of 3000 files can be returned. # - For more flexibility and no limitations see "Using local .git directory" above. runs-on: ubuntu-latest # windows-latest || macos-latest name: Test changed-files permissions: pull-requests: read steps: - name: Get changed files id: changed-files uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 - name: List all changed files env: ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | for file in ${ALL_CHANGED_FILES}; echo "$file was changed" done ``` -------------------------------- ### getDirname Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Gets the directory name from a file path, with special handling for Windows UNC paths. ```APIDOC ## getDirname() ### Description Gets directory name, handling Windows UNC paths. ### Parameters #### Path Parameters - **p** (string) - Required - File path ### Return Type `string` — Directory path ``` -------------------------------- ### Matrix Format Output Example Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/outputs.md Set 'matrix: true' for use in GitHub matrix jobs. This formats the output as a JSON array of objects, suitable for defining build matrices. ```yaml strategy: matrix: # This becomes [{"file":"src/file1.ts"}, {"file":"src/file2.ts"}] include: ${{ fromJson(steps.changed-files.outputs.all_changed_files) }} ``` -------------------------------- ### Get Directory Name Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Retrieves the directory name from a given file path, with special handling for Windows UNC paths. ```typescript export function getDirname(p: string): string ``` -------------------------------- ### run() Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/main.md Main entry point for the GitHub Action. Orchestrates file change detection using either GitHub's REST API or local git history, depending on context and inputs. ```APIDOC ## run() ### Description Main entry point for the GitHub Action. Orchestrates file change detection using either GitHub's REST API or local git history, depending on context and inputs. ### Parameters None. Retrieves inputs and environment from GitHub Actions context. ### Return Type `Promise` — Completes when all changed files have been detected and outputs set. Throws on error. ### Behavior 1. Retrieves environment variables and action inputs 2. Determines working directory from `inputs.path` and `$GITHUB_WORKSPACE` 3. Checks for local `.git` directory 4. Loads file patterns from `files`, `files_yaml`, or source files 5. Decides between REST API or local git diff based on: - Event type (pull_request, push, merge_group support REST API) - Availability of `.git` directory - `use_rest_api` input setting 6. Executes diff and processes results 7. Outputs all detected changed files and matching status ### Error Cases - Throws if local `.git` directory not found and REST API not available - Throws if REST API requested for unsupported event type - Throws if git version is below minimum (2.18.0) - Throws if diff operations fail and `fail_on_initial_diff_error` or `fail_on_submodule_diff_error` is set ### Usage Example ```typescript import {run} from './main' // Called automatically by GitHub Actions // No direct usage needed in most cases run().catch(error => { console.error('Action failed:', error.message) process.exit(1) }) ``` ``` -------------------------------- ### YAML Example for Action Inputs Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/inputs.md Illustrates how to configure inputs for the `tj-actions/changed-files` action within a GitHub Actions workflow YAML file. It shows setting multiline `files` input and other common parameters like `separator` and `json`. ```yaml - uses: tj-actions/changed-files@main with: files: | src/** tests/** separator: ',' json: true ``` -------------------------------- ### getRemoteBranchHeadSha() Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Gets the 40-character commit SHA of a remote branch's HEAD. Requires the branch name and remote name. ```APIDOC ## getRemoteBranchHeadSha() ### Description Gets the commit SHA of a remote branch's HEAD. ### Method `async` ### Parameters #### Path Parameters - **cwd** (string) - Required - Repository root directory - **branch** (string) - Required - Branch name (without refs/) - **remoteName** (string) - Required - Remote name (e.g., 'origin') ### Return Type `Promise` — 40-character commit SHA ``` -------------------------------- ### getCurrentBranchName() Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Gets the current branch name in its short form (without 'refs/'). Returns an empty string if the HEAD is detached. ```APIDOC ## getCurrentBranchName() ### Description Gets the current branch name (short form, no refs/). ### Method `async` ### Parameters #### Path Parameters - **cwd** (string) - Required - Repository root directory ### Return Type `Promise` — Branch name or empty string if detached HEAD ``` -------------------------------- ### TypeScript Usage Example for getInputs Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/inputs.md Demonstrates how to import and use the `getInputs` function in a TypeScript script. It shows how to access parsed input values like `files` and `useRestApi`, and how to conditionally log the output format. ```typescript import {getInputs} from './inputs' const inputs = getInputs() console.log('Files to check:', inputs.files) console.log('Use REST API:', inputs.useRestApi) console.log('Output format:', inputs.json ? 'JSON' : 'String') // Process inputs in action ``` -------------------------------- ### Get Current Branch Name Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Retrieves the short name of the current branch. Returns an empty string if the HEAD is detached. ```typescript export async function getCurrentBranchName({cwd}: {cwd: string}): Promise ``` -------------------------------- ### Get HEAD Commit SHA Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Retrieves the 40-character commit SHA of the current HEAD. Requires the repository root directory. ```typescript export async function getHeadSha({cwd}: {cwd: string}): Promise ``` -------------------------------- ### Different Actions for Different Directories Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/README.md Use YAML to define file patterns for different actions. This snippet shows how to trigger frontend builds and backend deployments based on changes in their respective directories. ```yaml - uses: tj-actions/changed-files@main id: changed-files with: files_yaml: | frontend: - src/** backend: - api/** - name: Build frontend if: steps.changed-files.outputs.frontend_any_changed == 'true' run: npm run build:frontend - name: Deploy backend if: steps.changed-files.outputs.backend_any_changed == 'true' run: npm run deploy:backend ``` -------------------------------- ### Output Format: getRenamedFiles (Default Separators) Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/changedFiles.md Illustrates the default output format for renamed files, showing old and new names separated by a comma and pairs by a space. ```text old1.ts,new1.ts new2.ts,new2-renamed.ts ``` -------------------------------- ### Get Parent Commit SHA Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Retrieves the 40-character commit SHA of the parent of HEAD. Returns an empty string if there is no parent commit. ```typescript export async function getParentSha({cwd}: {cwd: string}): Promise ``` -------------------------------- ### gitFetch() Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Executes the 'git fetch' command with specified arguments. Returns the exit code of the command, where 0 indicates success. ```APIDOC ## gitFetch() ### Description Executes git fetch command with additional arguments. ### Method `async` ### Parameters #### Path Parameters - **args** (string[]) - Required - Git fetch arguments (e.g., `--deepen=25`, `refs`) - **cwd** (string) - Required - Repository root directory ### Return Type `Promise` — Exit code (0 = success) ``` -------------------------------- ### Get Changed Files from GitHub API Signature Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/changedFiles.md This is the function signature for getChangedFilesFromGithubAPI. It takes an inputs object and returns a Promise of ChangedFiles. ```typescript export async function getChangedFilesFromGithubAPI({ inputs }: { inputs: Inputs }): Promise ``` -------------------------------- ### Take action based on specific changed files Source: https://github.com/tj-actions/changed-files/blob/main/README.md This snippet shows how to use the 'files' input to specify a list of files and then take action based on outputs like 'any_changed', 'only_changed', or 'any_deleted'. ```yaml ... - name: Get changed files id: changed-files-specific uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 with: files: | my-file.txt *.sh *.png !*.md test_directory/** **/*.sql - name: Run step if any of the listed files above change if: steps.changed-files-specific.outputs.any_changed == 'true' run: | echo "One or more files listed above has changed." - name: Run step if only the files listed above change if: steps.changed-files-specific.outputs.only_changed == 'true' run: | echo "Only files listed above have changed." - name: Run step if any of the listed files above is deleted if: steps.changed-files-specific.outputs.any_deleted == 'true' env: DELETED_FILES: ${{ steps.changed-files-specific.outputs.deleted_files }} run: | for file in ${DELETED_FILES}; do echo "$file was deleted" done - name: Run step if all listed files above have been deleted ``` -------------------------------- ### gitSubmoduleDiffSHA() Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Gets commit SHAs of a submodule between two parent commits. Returns an object containing the previous and current commit SHAs for the submodule. ```APIDOC ## gitSubmoduleDiffSHA() ### Description Gets commit SHAs of a submodule between two parent commits. Returns an object containing the previous and current commit SHAs for the submodule. ### Method (Not specified, likely an async function call) ### Parameters #### Path Parameters (None) #### Query Parameters (None) #### Request Body (None) ### Parameters (Function Arguments) - **cwd** (string) - Current working directory - **parentSha1** (string) - SHA of the parent commit for the first reference - **parentSha2** (string) - SHA of the parent commit for the second reference - **submodulePath** (string) - Path to the submodule - **diff** (string) - The diff string ### Request Example (Not specified) ### Response #### Success Response ({previousSha?: string; currentSha?: string}) - Object containing previous and current submodule SHAs #### Response Example (Not specified) ``` -------------------------------- ### Skip Initial Fetch for Large Repositories Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/errors.md Suggests setting 'skip_initial_fetch: true' to avoid potential timeouts in very large repositories where history fetching is slow. ```yaml skip_initial_fetch: true ``` -------------------------------- ### gitRenamedFiles() Source: https://github.com/tj-actions/changed-files/blob/main/_autodocs/api-reference/utils.md Gets renamed files between two commits. It returns an array of strings, where each string represents a renamed file in the format 'old,new'. ```APIDOC ## gitRenamedFiles() ### Description Gets renamed files between two commits. Returns an array of strings, where each string represents a renamed file in the format 'old,new'. ### Method (Not specified, likely an async function call) ### Parameters #### Path Parameters (None) #### Query Parameters (None) #### Request Body (None) ### Parameters (Function Arguments) - **cwd** (string) - Current working directory - **sha1** (string) - The first commit SHA - **sha2** (string) - The second commit SHA - **diff** (string) - The diff string - **oldNewSeparator** (string) - Separator for old and new file names - **isSubmodule** (boolean) - Optional: Whether to consider submodules (defaults to false) - **parentDir** (string) - Optional: Parent directory path ### Request Example (Not specified) ### Response #### Success Response (string[]) - Array of 'old,new' pairs representing renamed files #### Response Example (Not specified) ```