A workflow must only run when files in `services/api/` change.
BeginnerScenarioGitHub Actions
Answer
Situation read → Path filtering.
What I'd do →
on:
pull_request:
paths: ['services/api/**', '.github/workflows/api.yml']
If the check is a required status check, a skipped workflow stays "pending", so use a small always-run job or a path filter action such as dorny/paths-filter inside one workflow.
Why → Required checks and path filters conflict, which is a common surprise.
Interview tip → Mention the pending-required-check pitfall.
More on GitHub Actions
What are workflows, jobs, steps and actions in GitHub Actions?BeginnerWhat events can trigger a workflow?BeginnerWhat is the difference between `pull_request` and `pull_request_target`?AdvancedWhat is a runner, and how do GitHub-hosted and self-hosted runners differ?BeginnerHow do you pass data between steps and between jobs?IntermediateHow does a build matrix work?Intermediate