Skip to content
Latchkey

dorny/paths-filter: Conditional Jobs by Changed Paths

paths-filter outputs which path groups changed so you can skip unrelated jobs.

Define named filters with path globs. The action sets a true/false output per filter you reference in if: conditions, ideal for monorepos.

Key inputs (with:)

  • filters: YAML mapping of name to path globs.
  • base: base ref to diff against.
  • list-files: also output the changed file list.
  • token: token for fetching the diff on PRs.

Example workflow

.github/workflows/ci.yml
jobs:
  changes:
    runs-on: ubuntu-latest
    outputs:
      api: ${{ steps.filter.outputs.api }}
    steps:
      - uses: actions/checkout@v4
      - id: filter
        uses: dorny/paths-filter@v3
        with:
          filters: |
            api:
              - 'api/**'
  api:
    needs: changes
    if: ${{ needs.changes.outputs.api == 'true' }}
    runs-on: ubuntu-latest
    steps:
      - run: echo "build api"

On any runner

This action runs on any runner. Latchkey managed runners run it unchanged, and skipping unrelated jobs saves minutes.

Key takeaways

  • Expose filter outputs from a job, then gate downstream jobs.
  • Ideal for monorepos to avoid building everything.
  • Use list-files when you need the actual changed paths.

Related guides

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