C.W.K.
Stream
Lesson 11 of 14 · published

Path Filters

~8 min · paths, filters, skip

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Skip workflows that don't apply

The simplest dynamic matrix is 'skip the workflow entirely if the change doesn't touch what this workflow tests'. paths: and paths-ignore: under an event filter the entire workflow.

Patterns

  • Glob: 'src/**', '**/*.py'.
  • Multiple: ['src/**', 'tests/**'].
  • Negation isn't supported in the YAML filter; use paths-ignore instead.

What gets evaluated

The diff between the previous SHA and the new push (or between the PR base and head). If any changed file matches the filter, the workflow runs. Otherwise it doesn't trigger at all.

Path filters interact with required checks

If a workflow that's a required status check is filtered out by paths, the check won't fire — but it's still 'required'. PRs that don't touch matching files will hang. Solutions:

  • Configure 'Allow merging if status checks are skipped' (depends on policy).
  • Use a no-op fallback workflow that always reports green.
  • Use paths-filter action inside the job, not at the workflow level.

Code

Skip workflow when only docs changed·yaml
name: ci
on:
  pull_request:
    paths-ignore:
      - 'docs/**'
      - '*.md'
  push:
    branches: [main]
    paths-ignore:
      - 'docs/**'
      - '*.md'

External links

Exercise

Add paths-ignore: ['docs/**', '*.md'] to your CI workflow. Open a docs-only PR and confirm CI doesn't trigger. Make sure required status checks don't hang (adjust if they do).

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.