Skip to content
Latchkey

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

Run this faster and cheaper on Latchkey managed runners. Start free →