GitHub 把只欠審批的 PR 顯示為檢查失敗,開發者製作 Chrome 擴充功能修正提示
GitHub told me my checks were failing. They weren't. The PR just needed a review.
開發者為 GitHub 製作 Chrome 擴充功能 Chill Pill for GitHub,將只因欠缺審批而受阻的合併提示改為「需要審批」,避免誤示必要檢查失敗。若有真正的 CI 檢查失敗,擴充功能會保留 GitHub 原有的紅色提示;無法確認時亦不會更改介面。擴充功能不要求權限、不追蹤、不使用分析功能,也不儲存資料,並以 MIT 授權。
If your repo uses rulesets with a required review, you've probably seen this:
CI passed, everything's green, and the merge box still screams red "Required checks failing. Fix the failing required checks."
Nothing is failing. Nobody approved the PR yet, that's it.
Every single time I see that red X I go open the checks to see what broke. Every single time nothing broke. After the 50th time it stopped being a UI quirk and started being annoying as hell, so I wrote a small Chrome extension for it.
What it does
When the only thing blocking the merge is a missing approval, Chill Pill for GitHub changes the merge box to:
- heading "Review required" instead of "Required checks failing"
- subtext "At least 1 approving review is required."
- yellow badge instead of the red one (light and dark theme)
- GitHub's own yellow "pending" favicon in the tab instead of the red one
If a real check fails, you get the original red back right away. That was the one hard rule: never hide an actual failure.
One thing you'll notice in the screenshot: the checks bar at the bottom still says "1 required failing". That's GitHub counting the review gate as a check. I only touch the header, the badge and the favicon, the rest stays as GitHub renders it.
How it decides
This is the only part that's slightly interesting.
The checks list in the merge box is often collapsed, so reading the DOM isn't reliable. Instead the extension calls the same endpoint the merge box itself uses:
GET /{owner}/{repo}/pull/{n}/page_data/status_checks
Same origin, your own session, so no extra permissions needed. From that it takes every check in a failing state (FAILURE, ERROR, TIMED_OUT, CANCELLED, ...). If any of them is a real CI check, it does nothing. It only kicks in when every failing check is a review gate and the merge box itself says an approval is missing.
If the endpoint isn't available, it falls back to reading the checks from the page. Whenever it's not sure, it leaves GitHub's UI alone. A false "this is fine" is way worse than a false alarm.
Not fighting React
GitHub's PR page is React, and React really doesn't like it when you mess with its DOM. So the extension:
- never uses
innerHTMLand never replaces nodes - only changes the
nodeValueof the two text nodes (heading and subtext) - switches colours through
data-*attributes styled from its own CSS - watches the page with a
MutationObserverand reverts everything as soon as the condition stops holding
Privacy
- no permissions at all in the manifest
- one content script on github.com
- no tracking, no analytics, nothing stored, no remote code
- MIT licensed
Full disclosure
Claude helped me a ton with making this extension real. The annoyance was 100% mine though.
Links
- Chrome Web Store: https://chromewebstore.google.com/detail/chill-pill-for-github/pndgcjcpmbcfoghifgpfkgdpnccdffik
- Source: https://github.com/kralmichal/github-chill-pill
It's brand new, so if it does something weird on your repo setup, open an issue or tell me in the comments. And if GitHub fixes this themselves one day, great, I'll happily delete the whole thing.
來源:DEV Community · dev.to
