Interview Prep/GitHub Actions/Pipeline Design & Triggers

You need to run a job only when files in `infra/` changed, but the workflow also has other jobs that always run. How?

IntermediateScenarioPipeline Design & Triggers
Answer

Situation read → Workflow-level paths would skip everything; need job-level filtering.

What I'd do →

  1. A changes job using dorny/paths-filter with outputs infra: 'true'|'false'.
  2. terraform job: needs: changes, if: needs.changes.outputs.infra == 'true'.
  3. Fan-in job treats skipped as success.

Why → Skipped jobs report as success to branch protection, skipped workflows report nothing.

Interview tip → This is the canonical answer to "path filters vs required checks".

All GitHub Actions questions Roadmap: GitHub Actions

More on Pipeline Design & Triggers