PRs-lines-changed: Add new userscript#221
Open
karthikeyann wants to merge 2 commits into
Open
Conversation
Show added/removed line counts on pull request list pages and add a "lines changed" sort option to the existing sort menu. Counts are fetched with a single GraphQL request per repository and cached locally, so a personal access token (set via the userscript manager menu) is required.
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 this adds
A new userscript, GitHub PRs lines changed, that:
+x -y) next to each pull request on PR list pages (e.g./owner/repo/pulls).How it works
Line counts (
additions/deletions) are only available per pull request from the GitHub API, so the script:localStoragefor instant paint on revisits, then always re-queries so counts stay current when PRs get new commits.MutationObserver, guarding its own DOM writes so it never reacts to itself.Token requirement
Because the counts come from the API, the script needs a personal access token, requested once via the userscript manager menu ("Set GitHub token for PR line counts") and stored locally — never in the script file:
repo(classic) or read-only fine-grained access.Checklist
master(branchadd-pr-lines-changed).npx eslintwith the repo's.eslintrc(0 errors/warnings).LF, trailing newline per.editorconfig.[plc-wiki]/[plc-raw]reference links (GF/OU links and the wiki page left for the maintainer to publish).Happy to adjust the name, metadata, or token UX to better fit the project's conventions.