Skip to content

ci: fail the Branch protection check when a job it waits on does not succeed - #3840

Merged
armando-navarro merged 2 commits into
angular:mainfrom
armando-navarro:ci-branch-protection-always-runs
Nov 6, 2026
Merged

armando-navarro merged 2 commits into
angular:mainfrom
armando-navarro:ci-branch-protection-always-runs

Conversation

@armando-navarro

Copy link
Copy Markdown
Collaborator

Fixes #3839

The Branch protection job is main's required CI check, and it was skipped, which GitHub counts as passing, whenever one of the jobs it waits on failed. The evidence and the proof runs are in #3839.

Changes

  • if: ${{ always() }} on the job, so it runs on every outcome of test, contribute, browser and firebase-13.

  • One step that exits 1 when any of those results is failure, cancelled or skipped. skipped is included because a failed build skips three of the four jobs rather than failing them.

  • A two-line comment saying why the job uses always() and not !cancelled().

  • The job name is unchanged, so the branch protection setting does not change.

Behavior to know

  • A cancelled run now leaves the check red instead of skipped.
  • A failed build now leaves the check red. Before, contribute could pass on its own and the check would be skipped.

Verified

  • The same job on a throwaway repository with the same job graph: red on a failed test leg, a failed build and a cancelled run, green when everything passes, and the old job skipped on a failed test leg.

  • This pull request's own run exercises the all-pass case.

…succeed

The job is main's required status check. Without an if: it was skipped
whenever test, contribute, browser or firebase-13 failed, and GitHub
counts a skipped required check as satisfied, so a pull request with red
tests stayed mergeable. Now the job always runs and exits 1 unless every
needed job succeeded. skipped is included because a failed build skips
three of the four jobs rather than failing them, and always() rather than
!cancelled() because a cancelled run must also leave the check red.

Found by Tyler Reitz on angular#3762.
@armando-navarro armando-navarro added comp: build/pipeline Build, bundling, packaging, release pipeline. type: bug Defect: expected behavior doesn't happen. labels Nov 5, 2026
@armando-navarro armando-navarro added this to the 22.0.0-rc.1 milestone Nov 5, 2026
@armando-navarro
armando-navarro merged commit 419db92 into angular:main Nov 6, 2026
25 checks passed
@armando-navarro
armando-navarro deleted the ci-branch-protection-always-runs branch November 6, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: build/pipeline Build, bundling, packaging, release pipeline. type: bug Defect: expected behavior doesn't happen.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Branch protection is skipped, and counts as passing, when a job it waits on fails

2 participants