mirror of
https://github.com/GetOpenScript/GitHub.openscript.git
synced 2026-09-18 08:25:42 +00:00
2.0 KiB
2.0 KiB
Display Repo and File Sizes for GitHub
A lightweight OpenScript that displays total repository disk usage in the About section and each file's size beside its name in GitHub's file browser.
Features
- Accurate Git History Size: Uses GitHub's native
repo.sizedisk usage measurement, accurately reflecting the full Git history, delta compression, and packfiles rather than loose blobs. - New Repo Handling: If a repository was just pushed and GitHub is still computing initial disk usage (
0 KB), it provides a friendly indicator (0 KB (calculating...)) until GitHub finishes indexing. - Integrated in About Section: Injects cleanly under repository details in the right sidebar.
- Individual File Sizes: Shows human-readable byte sizes beside files in root and nested directory listings.
- GitHub-Native Layout: Targets only responsive filename cells, leaving commit messages, dates, links, and directory rows untouched.
- Private Repositories Supported: Uses
GH_PATfrom OpenScript secrets for private repositories and increased rate limits. - Turbo / SPA Compatible: Seamlessly persists across GitHub's Turbo and client-side page transitions.
- No Cache or Script Storage: Reads fresh repository and directory data from GitHub's API for each rendered view.
Installation in OpenScript
- Open the OpenScript extension popup.
- Click + New in the header (or click your existing script to edit).
- Paste the contents of
DisplayRepoSizeGitHub.user.js. - Click save script.
GitHub PAT Configuration (for Private Repos)
- Generate a GitHub Personal Access Token (
reposcope for private repos) at github.com/settings/tokens. - Open OpenScript and switch to the Secrets tab.
- Add a secret:
- Key:
GH_PAT - Value:
<your_token>
- Key:
- Click + Add. OpenScript synchronizes the secret via
chrome.storage.syncand securely provides it to your script asOpenScript.env.GH_PAT.