Why require status checks by job name and what is a common pitfall?
BeginnerProductionBranch protection, rulesets, CODEOWNERS and review at scale
Answer
The required check is matched by name. If a workflow is skipped through path filters, the required check stays pending forever and blocks the PR. Fix by having an always-running aggregate job (ci-ok) as the single required check, with needs: on the real jobs and if: always() logic.
ci-ok:
needs: [build, test, lint]
if: always()
runs-on: ubuntu-latest
steps:
- run: test "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" = "false"
More on Branch protection, rulesets, CODEOWNERS and review at scale
What branch protection settings do you enable on `main` by default?BeginnerWhy do rulesets win over classic branch protection for an organisation?IntermediateHow do you roll out a new org-wide ruleset without breaking 300 repos?AdvancedHow do you protect release tags from being moved or deleted?IntermediateHow do you structure CODEOWNERS for a large org?IntermediateCODEOWNERS says three teams own a path but PRs stall waiting for any one of them. How do you fix it?Advanced