Skip to content

CICD-009 · Filter service paths ​

Encyclopedia · Events and triggers · All snippets

Previous · CICD-008 · Next · CICD-010

1. Where it fits ​

  • Placement .github/workflows/ci.yml, at workflow level, or within jobs for a named job mapping.
  • Prerequisites workflow on an example repository with main as default.
  • Platforms github-actions, gitea-actions.

2. Copy the snippet ​

yaml
on:
  push:
    paths: ["services/api/**", "uv.lock"]

3. How it works ​

The changed-file set is evaluated against the globs at workflow admission. Include shared dependency files so an input change does not bypass checks.

Changed paths determine whether the workflow is admitted.

flowchart TD
  N1["Push"]
  N2{"Watched file changed"}
  N1 --> N2
  N3["Queue checks"]
  N2 -->|Yes| N3
  N4["Skip workflow"]
  N2 -->|No| N4

4. Verify the result ​

Push a change in each watched input. Keep required gate checks discoverable.

Watch for. Place event filters at workflow scope and test an event that should run and an event that should be skipped.

Validation syntax-validated (YAML parse). Status definitions.