tj-actions/changed-files: List Changed Files in CI
changed-files outputs the exact files changed so steps can react to them.
Unlike path filters, this returns the file list itself (and per-pattern subsets), letting you lint only changed files or run targeted checks. Pin it to a full commit SHA for supply-chain safety.
Key inputs (with:)
- files: glob(s) to scope and split the output.
- separator: delimiter for the output list.
- since_last_remote_commit: diff strategy control.
- fetch_depth: history depth for the diff.
Example workflow
.github/workflows/ci.yml
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: changed
uses: tj-actions/changed-files@v45
with:
files: '**/*.js'
- if: steps.changed.outputs.any_changed == 'true'
run: npx eslint ${{ steps.changed.outputs.all_changed_files }}On any runner
This action runs on any runner. Latchkey managed runners run it unchanged.
Key takeaways
- Gives you the file list, not just a changed/not-changed flag.
- Needs fetch-depth: 0 for an accurate diff.
- Pin to a commit SHA for supply-chain safety.
Related guides
dorny/paths-filter: Conditional Jobs by Changed PathsReference for dorny/paths-filter: detect which paths changed in a push or PR and gate downstream jobs or step…
actions/checkout: Inputs & Workflow UsageReference for actions/checkout: clone your repository into the runner, control fetch-depth, submodules, refs,…
actions/labeler: Auto-Label PRs by Changed PathsReference for actions/labeler: automatically apply labels to pull requests based on which files they touch, c…