Title: `Branch protection` is skipped, and counts as passing, when a job it waits on fails · Issue #3839 · angular/angularfire · GitHub
Open Graph Title: `Branch protection` is skipped, and counts as passing, when a job it waits on fails · Issue #3839 · angular/angularfire
X Title: `Branch protection` is skipped, and counts as passing, when a job it waits on fails · Issue #3839 · angular/angularfire
Description: While reviewing #3762, @tyler-reitz noticed that the pull request's test jobs had failed while the Branch protection check showed as skipping, and nothing marked the pull request as blocked. I looked into it and it's real. Here is what I...
Open Graph Description: While reviewing #3762, @tyler-reitz noticed that the pull request's test jobs had failed while the Branch protection check showed as skipping, and nothing marked the pull request as blocked. I look...
X Description: While reviewing #3762, @tyler-reitz noticed that the pull request's test jobs had failed while the Branch protection check showed as skipping, and nothing marked the pull request as blocked. I ...
Opengraph URL: https://github.com/angular/angularfire/issues/3839
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`Branch protection` is skipped, and counts as passing, when a job it waits on fails","articleBody":"While reviewing #3762, @tyler-reitz noticed that the pull request's test jobs had failed while the `Branch protection` check showed as skipping, and nothing marked the pull request as blocked. I looked into it and it's real. Here is what I found and the fix I propose.\n\n### What happens\n\n- `.github/workflows/test.yml` ends with a job named `Branch protection` whose only purpose is to wait on `test`, `contribute`, `browser` and `firebase-13` and then run `true`. Together with the CLA check it is the required status check on `main`.\n\n- The job has no `if:` condition. When a job it waits on fails, GitHub skips it instead of failing it.\n\n- GitHub treats a skipped required check as satisfied. Its page on required status checks says \"Successful check statuses are success, skipped, and neutral\", and lists \"a job depends on a failed job\" as a case where \"the dependent job is skipped and may not block merging\".\n\n- `main` also requires one approving review, and a review is not dismissed when later commits are pushed. So a pull request that was approved and then goes red stays mergeable for anyone the protection applies to.\n\n### Where it has shown up\n\n- #3762: on commit 40537e5, 12 test jobs failed and `Branch protection` concluded `skipped`. The approving review was submitted between that commit and the next. The next commit, 77a056f, had 4 failing jobs and the check was skipped again. Only 452c501 turned it green.\n\n- #3831: on commit fe1e281, the three `Test Node 26` jobs failed and `Branch protection` concluded `skipped`.\n\n- No pull request has merged in this state. Each of the last 40 merged pull requests had the check at `success` on its merged head. The gap is latent, but on #3762 it was open for about eleven hours.\n\n### The fix\n\nMake the job run on every outcome and fail itself unless every job it waits on succeeded:\n\n```yaml\n test_and_contribute:\n runs-on: ubuntu-latest\n name: Branch protection\n needs: ['test', 'contribute', 'browser', 'firebase-13']\n if: ${{ always() }}\n steps:\n - name: Fail unless every needed job succeeded\n if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}\n run: exit 1\n```\n\nThree details matter:\n\n- `skipped` has to count as a failure. `test`, `browser` and `firebase-13` depend on `build`, so when `build` fails they are skipped rather than failed, while `contribute` builds on its own and can still pass.\n - Without `skipped` in the condition a broken build would still turn the check green.\n - On a pull request none of the four jobs can be skipped for any other reason, since none has an `if:` of its own and the `pull_request` trigger has no path filter.\n\n- `always()` rather than the usually recommended `!cancelled()`.\n - A cancelled run must leave the check red, and with `!cancelled()` the aggregator itself would be skipped on cancellation, which brings the gap back.\n - GitHub's warning against `always()` is about steps that fetch sources and could hang, which this job does not do.\n\n- The job name does not change, so the branch protection setting needs no edit and no admin.\n\n### Verified\n\nI reproduced both the gap and the fix in a throwaway repository with the same job graph (build, a three-leg test matrix with `fail-fast: false`, browser, an independent contribute, and this job), one pull request per case:\n\n- Old job, one test leg fails: `Branch protection` is `skipped`.\n- Fixed job, one test leg fails: `failure`.\n- Fixed job, build fails: `failure`, through the `skipped` results.\n- Fixed job, run cancelled while the test legs ran: `failure`, through the `cancelled` results.\n- Fixed job, everything passes: `success`.\n\nWith `main` in that repository protected by `Branch protection` as its only required check, GitHub's own merge state per pull request confirms the effect:\n\n- Old job, one test leg fails: `UNSTABLE`, which still allows the merge. Only a non-required check failed, and the skipped required one counts as satisfied.\n- Fixed job, the three failure cases: `BLOCKED`.\n- Fixed job, everything passes: `CLEAN`.\n\nThe same three-condition step is used in public by other projects, for example `ublue-os/akmods`.\n\n### Out of scope here, noted for a separate look\n\n- The release branches `21.1.x`, `21.0.x` and `20.1.x` have no branch protection at all, so a cherry-pick pull request into them needs no green check to merge. Changing that needs an admin.\n\n- `Publish (NPM)` does not wait on `contribute`, so a `contribute`-only failure on `main` still publishes a canary.\n\nThanks to @tyler-reitz for spotting this.\n","author":{"url":"https://github.com/armando-navarro","@type":"Person","name":"armando-navarro"},"datePublished":"2026-11-05T20:14:54Z","url":"https://github.com/angular/angularfire/issues/3839"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:63186e04-ab36-04f8-eb96-7bd15060333c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A948:187983:3466549:4516E80:6B03601F |
| html-safe-nonce | b87061f078a7d96c7c8d2b34e19895f355f6da2cf2d3590826a6465223f052f2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTQ4OjE4Nzk4MzozNDY2NTQ5OjQ1MTZFODA6NkIwMzYwMUYiLCJ2aXNpdG9yX2lkIjoiODAyNjY1OTIyNjg2MDUwMzM1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 58e4973a69a7f6d8bc3fbe24b3e61ad7eafda2c8a89c3fd368cea289b51b9889 |
| hovercard-subject-tag | issue:6230862496 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angularfire/3839/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d3f0c3c594b2c66f768ba56a00ace0517de843a9d3ba9e562a410ff3fb1798fa/angular/angularfire/issues/3839 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d3f0c3c594b2c66f768ba56a00ace0517de843a9d3ba9e562a410ff3fb1798fa/angular/angularfire/issues/3839 |
| og:image:alt | While reviewing #3762, @tyler-reitz noticed that the pull request's test jobs had failed while the Branch protection check showed as skipping, and nothing marked the pull request as blocked. I look... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | armando-navarro |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angularfire git https://github.com/angular/angularfire.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 49453413 |
| octolytics-dimension-repository_nwo | angular/angularfire |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49453413 |
| octolytics-dimension-repository_network_root_nwo | angular/angularfire |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width