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
Dependabot: dependabot.yml Configuration ReferenceReference for dependabot.yml: configure automated dependency update PRs per ecosystem, including update sched…
GitHub Actions Deprecations: What Is Breaking and How to Fix ItA running list of GitHub Actions deprecations - Node runtime versions, workflow commands, and runner images -…
JamesIves/github-pages-deploy-action: Deploy to PagesReference for JamesIves/github-pages-deploy-action: deploy a built folder to a GitHub Pages branch, with fold…