Add GitHub PR Approve Helper userscript - #6
Merged
Conversation
Auto-fills the review comment with a random LGTM-style text when selecting Approve in the GitHub pull request review dialog. Supports both the new react review dialog and the legacy review dropdown. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JL2YxajmCPuDRWyejSpCJM
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JL2YxajmCPuDRWyejSpCJM
- narrow @match to https://github.com/linear-b/* - expand the list of approve comments - inject a dropdown above the review textarea to pick a specific comment (or a random one) on demand - bump version 1.2.0 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JL2YxajmCPuDRWyejSpCJM
- fill the comment when the review dialog opens with approve already selected (no change event fires in that case) - add a capture-phase click fallback for clicks on the label or on an already-selected approve radio - resolve event targets through composedPath for shadow dom safety - more console diagnostics, bump version 1.3.0 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JL2YxajmCPuDRWyejSpCJM
Shows a small self-removing badge on PR pages, so it's visible the script is injected and running without opening devtools. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JL2YxajmCPuDRWyejSpCJM
GitHub's trusted-types CSP breaks tampermonkey's page-context (MAIN world) injection with a mangled SyntaxError from appendChild. The script only needs DOM access, so run it in the extension's isolated world instead, which bypasses the page CSP entirely. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JL2YxajmCPuDRWyejSpCJM
Logs every radio change/click with full attribute details and dumps the radios/textareas of each dialog once, so real github markup can be compared against the selectors. DEBUG const to silence later. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JL2YxajmCPuDRWyejSpCJM
- automatically select the approve option when the review dialog opens
(AUTO_SELECT_APPROVE const to disable)
- auto-fill always inserts the deterministic DEFAULT_COMMENT ('LGTM');
the dropdown replaces it with an alternative on demand
- restyle the dropdown as a compact pill floating in the dialog header
next to the close button, instead of squeezing into the editor
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JL2YxajmCPuDRWyejSpCJM
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JL2YxajmCPuDRWyejSpCJM
There was a problem hiding this comment.
Pull request overview
Adds a new Tampermonkey userscript to streamline approving GitHub PRs within linear-b/* by auto-selecting “Approve”, auto-filling the review comment, and providing quick comment presets, plus registers the script in the repository README.
Changes:
- Add
github-pr-approve-helper.user.jsv1.0.0 to auto-select Approve, auto-fill/clear review text, and inject a preset dropdown + “active” badge. - Add README table entry and wiki/raw links for the new userscript.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| README.md | Adds the new userscript to the install table and link references. |
| github-pr-approve-helper.user.js | Implements the approve-helper behavior (dialog detection, autofill, dropdown, scoping, and badge). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- fall back to a plain value assignment when the native prototype setter is unavailable - coalesce mutation bursts into one scan per animation frame - re-show the active badge once per soft navigation Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JL2YxajmCPuDRWyejSpCJM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New Tampermonkey userscript
github-pr-approve-helper.user.js(v1.0.0) that speeds up approving pull requests, plus a README table entry.When the "Finish your review" dialog opens on a PR:
AUTO_SELECT_APPROVEconst to disable)LGTM— only when the box is empty, it never overwrites typed textNice,Great job! 🎉, 🎲 Random, …) — picking one replaces the textScoped to
https://github.com/linear-b/*(@match+ a runtimeALLOWED_ORGScheck that stays correct across GitHub's soft navigations).How
change/clickdelegation ondocument+ aMutationObserverfor the on-demand dialog — survives Turbo soft navigation and React re-mounts, no pollinginput/changeevents, so the text lands in React state (i.e. in the submitted review, not just on screen)@sandbox DOMruns the script in the extension's isolated world — github.com's Trusted-Types CSP breaks Tampermonkey's default page-context injection with a mangledSyntaxErrorfromappendChildname="reviewEvent") and the legacy review dropdown (pull_request_review[event])Testing
@sandbox DOM) against a React 18 replica of GitHub's review dialog — 18/18 checks pass (auto-select, default fill, no-overwrite, clear-on-switch-away, click fallback, dropdown replace/reset/re-inject, org scoping)🤖 Generated with Claude Code
https://claude.ai/code/session_01JL2YxajmCPuDRWyejSpCJM
Generated by Claude Code