Skip to content

(Last updated 3/24/25 - Forked) Retrieve all of the files changed/modified in a pull request or push's commits.

License

Notifications You must be signed in to change notification settings

UplandJacob/retrieve-changed-files

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
This branch is 74 commits ahead of masesgroup/retrieve-changed-files:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f314f55 · Mar 24, 2025
Nov 12, 2024
Mar 9, 2020
Nov 21, 2022
Nov 21, 2022
Nov 21, 2022
Mar 9, 2020
Nov 21, 2022
Mar 9, 2020
Mar 9, 2020
Mar 9, 2020
Mar 9, 2020
Mar 24, 2025
Nov 13, 2024
Mar 9, 2020
Mar 24, 2025
Mar 24, 2025
Mar 9, 2020
Mar 24, 2025

Repository files navigation

UplandJacob/retrieve-changed-files status

Forked from masesgroup/retrieve-changed-files

Originally from jitterbit/get-changed-files

This repo is kept up to date to prevent deprecation warnings in actions.

Retrieve All Changed Files

Retrieve all of the files changed/modified in a pull request or push's commits. You can choose to retrieve all changed files, only added files, only modified files, only removed files, only renamed files, or all added and modified files. These outputs are available via the steps output context. The steps output context exposes the output names all, added, modified, removed, renamed, and added_modified.

Usage

See action.yml for all options and outputs.

- uses: UplandJacob/retrieve-changed-files@v4
  with:
    # Format of the steps output context.
    # Can be 'space-delimited', 'csv', or 'json'.
    # Default: 'space-delimited'
    format: ''

Permissions

This action uses the Github Compare API, which requires at least the following permission:

permissions:
  contents: read

Scenarios

Retrieve all changed files as space-delimited

If there are any files with spaces in them, then this method won't work and the step will fail. Consider using one of the other formats if that's the case.

- id: files
  uses: UplandJacob/retrieve-changed-files@v4
- run: |
    for changed_file in ${{ steps.files.outputs.all }}; do
      echo "Do something with this ${changed_file}."
    done

Retrieve all added and modified files as CSV

- id: files
  uses: UplandJacob/retrieve-changed-files@v4
  with:
    format: 'csv'
- run: |
    mapfile -d ',' -t added_modified_files < <(printf '%s,' '${{ steps.files.outputs.added_modified }}')
    for added_modified_file in "${added_modified_files[@]}"; do
      echo "Do something with this ${added_modified_file}."
    done

Retrieve all removed files as JSON

- id: files
  uses: UplandJacob/retrieve-changed-files@v4
  with:
    format: 'json'
- run: |
    readarray -t removed_files <<<"$(jq -r '.[]' <<<'${{ steps.files.outputs.removed }}')"
    for removed_file in ${removed_files[@]}; do
      echo "Do something with this ${removed_file}."
    done

Install, Build, Lint, Test, and Package

Make sure to do the following before checking in any code changes.

$ yarn
$ yarn all

License

The scripts and documentation in this project are released under the MIT License

About

(Last updated 3/24/25 - Forked) Retrieve all of the files changed/modified in a pull request or push's commits.

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • JavaScript 56.6%
  • TypeScript 43.4%