Skip to content

About

GitHub maintenance toolkit: bulk unstar, org clone, cleanup forks, audit repos, and more

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

github-helpers

Release License: MIT Homebrew

GitHub maintenance toolkit — a single CLI for common GitHub bulk operations. Pure bash, zero dependencies beyond gh and jq.

Install

brew install maxgfr/tap/github-helpers

Or manually:

curl -fsSL https://raw.githubusercontent.com/maxgfr/github-helpers/main/script.sh -o /usr/local/bin/github-helpers
chmod +x /usr/local/bin/github-helpers

Requirements

  • gh — GitHub CLI (authenticated via gh auth login)
  • jq — JSON processor

Use it from an AI agent

The repo ships an agent skill that teaches Claude Code, Cursor, Codex and other agents how to drive the CLI safely — dry-run first, ask before anything destructive, never guess flags:

npx skills add maxgfr/github-helpers

Then ask in plain words: "download all my GitHub repos to ~/github-archive", "which of my forks can I delete?", "what is waiting on me on GitHub?".

Commands

Command Description
unstar Filter & bulk-unstar repos
cleanup-forks Audit forks; delete only inactive ones
sync-forks Update your forks from their upstream
cleanup-branches Delete merged, squash-merged or stale branches
archive-repos Batch archive inactive repos
release-cleanup Delete old releases, keep N latest
pr-cleanup Close abandoned pull requests
cleanup-packages Delete old GitHub Package versions
packages List packages, flag the orphaned and renamed, delete whole ones
stale-issues Find/close stale issues and PRs
cache-cleanup Purge Actions caches (10 GB/repo quota)
artifact-cleanup Delete Actions artifacts
run-cleanup Delete old workflow runs and their logs
gist List, export and bulk-delete gists
notifications Triage and bulk-clear your inbox
invite-cleanup List, accept or decline pending invitations
repo-audit Check for missing LICENSE, README, etc.
stats Dashboard: repos, stars, languages
workflow-status Red CI across your repos (head-commit checks)
secret-audit List Actions secrets & variables
license-check Check/add LICENSE files
vulnerability-check Audit Dependabot vulnerability alerts
branch-protection Audit/enforce branch protection rules
webhook-audit List webhooks across repos
collaborator-audit Audit outside collaborators and permissions
activity-report Activity summary for a period
traffic Snapshot views and clones (14-day window)
org-audit Org security and membership posture
follow-audit Who follows you back, and who does not
inbox What is waiting on you: replies, reviews, new issues
branches Open branches, commits ahead/behind the default branch
status Login, token scopes and API rate limits (free to run)
clone-org Clone/pull all repos from an org or user
bulk-topic Add/remove topics in batch
sync-labels Sync issue labels across repos
export-stars Export stars to JSON/CSV/Markdown
rename-default-branch Rename master→main in batch
dependabot-enable Enable Dependabot in batch
mirror Mirror repos to GitLab/Bitbucket/etc.
bulk-settings Apply repo settings in batch
repo-template Sync settings from a template repo
bulk-merge Merge green dependency-update PRs
backup Export repos and metadata locally
download Local copy of every repo you can access (public + private), kept in sync

Cleanup & maintenance

unstar — Clean up your GitHub stars

Filter and bulk-unstar repos by last commit date, last push date, or archived status.

# Preview: repos with no commit since 2024 OR archived
github-helpers unstar --commit-before 2024-01-01 --archived --dry-run -v

# Edit the generated list, then execute
vim unstar-repos.txt
github-helpers unstar --from unstar-repos.txt

# One-shot: unstar all archived repos
github-helpers unstar --archived -y
Flag Description
--commit-before DATE Last commit was before this date (YYYY-MM-DD)
--commit-after DATE Last commit was after this date
--activity-before DATE Last push was before this date
--activity-after DATE Last push was after this date
--archived / --not-archived Filter by archive status
--any Match if ANY filter hits (OR, default)
--all Match if ALL filters hit (AND)
--dry-run Preview only, saves list to file
--out FILE Output file (default: unstar-repos.txt)
--save-list Save the matched list even outside --dry-run
--from FILE Unstar from a previous dry-run file

cleanup-forks — Audit forks, delete only the inactive ones

Alias: github-helpers forks. A fork is kept when any activity signal fires — every protection is on by default and has an explicit opt-out.

# read-only audit, with the reason for every fork
github-helpers forks --report -v

# preview, review the list, then execute
github-helpers cleanup-forks --older-than 180 --dry-run
vim cleanup-forks.txt
github-helpers cleanup-forks --from cleanup-forks.txt
Protection (on by default) Opt out with
An open pull request from the fork --ignore-open-prs
Own commits on any branch --default-branch-only
Stars, watchers, or forks of the fork --ignore-popularity
Pushed or created within N days --older-than 0
Archived fork --include-archived
Upstream gone or private (orphan) --include-orphans
Flag Description
--user NAME / --org NAME Target (default: authenticated user)
--older-than N Only forks untouched for N days (default: 30)
--report Audit only — classify everything, never delete
--format table|json|csv Report format (default: table)
--max-branches N Protect, without verifying, above N branches (max 100)
--out FILE / --save-list / --from FILE Review-then-execute loop
--no-verify With --from, skip re-checking protections (dangerous)
--limit N Max forks to examine (default: 1000)

Deleting a fork permanently closes any pull request opened from it, so open PRs protect a fork by default. Anything that cannot be fully resolved is reported as SKIP and never deleted. Orphans need a second confirmation because their divergence cannot be verified.

Deletion needs the delete_repo scope: gh auth refresh -h github.com -s delete_repo.

sync-forks — Update your forks from their upstream

github-helpers sync-forks --dry-run
github-helpers sync-forks
github-helpers sync-forks --repo me/my-fork --branch main
Flag Description
--user NAME / --org NAME Target (default: authenticated user)
--repo OWNER/NAME Sync a single fork
--branch NAME Branch to sync (default: each fork's default branch)
--limit N Max forks to examine (default: 1000)

Reports SYNCED / UP-TO-DATE / CONFLICT / SKIPPED per fork. No confirmation prompt: merge-upstream only fast-forwards or merges from the upstream, so it never discards your work. Archived forks and orphans are skipped.

cleanup-branches — Delete merged, squash-merged or stale branches

Built on the same scan as branches, with the review-then-execute loop of unstar and cleanup-forks.

# preview every repo you own, review the list, then execute
github-helpers cleanup-branches --dry-run
vim cleanup-branches.txt          # delete the lines of the branches to keep
github-helpers cleanup-branches --from cleanup-branches.txt

# one repo, only branches with no commit ahead of the default branch
github-helpers cleanup-branches --repo maxgfr/my-repo --strict

# also stale branches, never release/hotfix ones, across an org
github-helpers cleanup-branches --org my-company --stale-days 90 --exclude "^(release|hotfix)/" --dry-run
Deleted Condition
MERGED No commit ahead of the default branch
PR_MERGED Its last PR was merged and the branch has not moved since (squash or rebase merge)
PR_CLOSED Its last PR was closed unmerged and the branch has not moved since
STALE Only with --stale-days N: no commit in N days

Never deleted: the default branch, protected branches, the head or base of an open pull request, and any branch that could not be fully verified (UNKNOWN). No branch of a repo with more than 100 open PRs is deleted.

Flag Description
--repo OWNER/REPO Single repository
--org NAME / --user NAME All non-archived source repos of an owner (default: you)
--merged The default; kept for compatibility
--strict Delete MERGED branches only (the previous behaviour)
--stale-days N Also delete STALE branches
--exclude REGEX Never touch branches matching REGEX
--dry-run / --out FILE Preview and write the list (default: cleanup-branches.txt)
--from FILE Delete the listed branches after re-checking each one
--limit N Max repos to scan (default: 1000)
-y Skip the confirmation prompt

--from rescans the listed repos: a branch whose SHA moved since the dry run, or whose verdict changed (an open PR appeared, for instance), is skipped and reported. The list keeps each branch's SHA, so a branch deleted by mistake can be restored with gh api repos/OWNER/REPO/git/refs -f ref=refs/heads/BRANCH -f sha=SHA.

Behaviour changes. A confirmation is now asked before deleting: scripts must pass -y. Squash-merged branches and branches of closed PRs are deleted by default (--strict restores the old rule). --stale-days adds to the default instead of replacing it, and no longer touches branches with an open PR. The target is optional and defaults to your repos.

archive-repos — Archive inactive repos

Batch archive repos with no push activity in N months.

github-helpers archive-repos --inactive-months 24 --dry-run
github-helpers archive-repos --org my-company --inactive-months 12 -y
Flag Description
--user NAME / --org NAME Target (default: authenticated user)
--inactive-months N Inactivity threshold (default: 12)
--language LANG Filter by language
--topic TOPIC Filter by topic

release-cleanup — Delete old releases

github-helpers release-cleanup --repo maxgfr/my-repo --keep 5 --dry-run
github-helpers release-cleanup --user maxgfr --pre-only --keep 3 -y
Flag Description
--repo OWNER/REPO Single repo
--user NAME / --org NAME All repos
--keep N Releases to keep (default: 5)
--pre-only Only delete pre-releases

pr-cleanup — Find and close abandoned PRs

Find and optionally close pull requests with no activity in N days.

github-helpers pr-cleanup --repo maxgfr/my-repo --days 60
github-helpers pr-cleanup --org my-company --draft-only --days 30
github-helpers pr-cleanup --repo maxgfr/my-repo --close --delete-branch --dry-run
Flag Description
--repo OWNER/REPO Single repo
--user NAME / --org NAME Target (default: authenticated user)
--days N Days without activity (default: 90)
--draft-only Only target draft PRs
--close Close abandoned PRs
--comment TEXT Comment before closing
--delete-branch Delete head branch after closing

cleanup-packages — Delete old package versions

Delete old GitHub Package versions, keeping the N most recent.

github-helpers cleanup-packages --type container --keep 3 --dry-run
github-helpers cleanup-packages --org my-company --type npm --keep 10
github-helpers cleanup-packages --type container --package myapp --keep 1
Flag Description
--user NAME / --org NAME Target (default: authenticated user)
--type TYPE Package type: npm, maven, rubygems, docker, nuget, container (required)
--package NAME Specific package name (default: all)
--keep N Versions to keep per package (default: 5)

packages — List packages, flag the orphaned and renamed, delete whole ones

Every package of a user or an organization, every type, with its visibility, the repository it is linked to, its versions and its last update — and a status: orphaned when it is linked to no repository, mismatch when no part of its name holds its repository's name. A mismatch is typically what a repository rename leaves behind: ghcr.io/me/old-name, still linked to me/new-name, which the workflows now push as ghcr.io/me/new-name. Variants such as new-name-lite or new-name/server are ok. Alias: pkgs.

github-helpers packages
github-helpers packages --type container --format md
github-helpers packages --org my-company --orphaned
github-helpers packages --mismatch --delete --dry-run   # writes packages-delete.txt
github-helpers packages --from packages-delete.txt      # deletes what is left in it
Flag Description
--user NAME / --org NAME Target (default: authenticated user, private packages included)
--type TYPE container, npm, maven, rubygems, docker or nuget (default: all of them)
--orphaned Linked to no repository
--mismatch No part of the name holds its repository's name
--untouched N Not updated in N days
--match PATTERN Case-insensitive regex on the name
--visibility VIS public, private or internal
--delete Delete the matched packages, every version (needs at least one filter)
--dry-run / --out FILE / --from FILE Review loop: write the annotated list, edit it, delete what is left
--format FORMAT text, json, csv or md

Deleting a package removes every version for good, and its name cannot be reused for 30 days; GitHub refuses to delete a public package with more than 5,000 downloads (it is reported as failed, with that reason). Needs the read:packages scope, and delete:packages to delete: gh auth refresh -h github.com -s read:packages,delete:packages. To trim old versions and keep the package, use cleanup-packages.

stale-issues — Find and close stale issues

Find and optionally close issues and PRs with no activity in N days.

github-helpers stale-issues --repo maxgfr/my-repo --days 180
github-helpers stale-issues --org my-company --type pr --days 60
github-helpers stale-issues --repo maxgfr/my-repo --close --comment "Closing as stale" --dry-run
Flag Description
--repo OWNER/REPO Single repo
--user NAME / --org NAME Target (default: authenticated user)
--days N Days without activity (default: 90)
--type TYPE Filter: issue, pr, all (default: all)
--label LABEL Filter by label
--close Close stale issues/PRs
--comment TEXT Comment before closing

cache-cleanup — Purge GitHub Actions caches

Each repository has a 10 GB Actions cache quota. Reports the bytes reclaimed.

github-helpers cache-cleanup --dry-run
github-helpers cache-cleanup --older-than 30 -y
github-helpers cache-cleanup --repo me/proj --keep 5
github-helpers cache-cleanup --org my-company --larger-than 500MB --dry-run
Flag Description
--older-than N Caches not accessed for N days
--key PATTERN Cache key matches this regex
--ref REF Only caches for this ref
--larger-than SIZE 100MB, 1.5GiB, 500K…
--keep N Keep the N most recently accessed per repo
--user / --org / --repo / --limit Targeting (--limit defaults to 200 repos)

artifact-cleanup — Delete GitHub Actions artifacts

github-helpers artifact-cleanup --dry-run
github-helpers artifact-cleanup --older-than 14 -y
github-helpers artifact-cleanup --repo me/proj --larger-than 200MB
Flag Description
--older-than N Artifacts created more than N days ago
--name PATTERN Artifact name matches this regex
--branch NAME Only artifacts from runs on this branch
--larger-than SIZE 100MB, 1.5GiB…
--expired Only already-expired artifacts

Expired artifacts no longer count against billed storage, so deleting them reclaims nothing. They are excluded by default; --expired selects only them, for tidiness.

run-cleanup — Delete old workflow runs

github-helpers run-cleanup --older-than 90 --dry-run
github-helpers run-cleanup --keep 10 -y
github-helpers run-cleanup --conclusion failure --older-than 30
github-helpers run-cleanup --repo me/proj --workflow ci.yml --keep 5
Flag Description
--older-than N Runs created more than N days ago
--keep N Keep the N most recent runs of each workflow
--conclusion C success, failure, cancelled, skipped…
--branch NAME / --workflow NAME Narrow further

--keep is per workflow, not per repo: a noisy workflow would otherwise wipe out the history of a rarely-run one. Deleting a run also deletes its logs and artifacts — to reclaim storage while keeping the history, use artifact-cleanup. Queued and in-progress runs are never deleted. At least one of --older-than, --keep or --conclusion is required.

gist — List, export and bulk-delete your gists

Alias: github-helpers gists.

github-helpers gist
github-helpers gist --format csv --out gists.csv
github-helpers gist --empty --no-description --delete --dry-run
github-helpers gist --from gist-delete.txt
Flag Description
--public / --secret Filter by visibility
--older-than N Created more than N days ago
--untouched N Not updated in N days
--empty All files empty or whitespace-only
--no-description No description
--match PATTERN Regex on the description or any filename
--starred Operate on gists you starred (read-only)
--delete Delete the matches (requires at least one filter)
--format text|json|csv|md, --out FILE Export
--dry-run / --save-list / --from FILE Review-then-execute loop

Filters are ANDed, unlike unstar's default OR — you are building a deletion set, and an OR would be a trap. --empty reads file sizes from the listing for free and only fetches the content of gists whose largest file is under 64 bytes. The generated list is annotated, because a bare 32-hex gist id tells a human nothing.

notifications — Triage your notification inbox

Alias: github-helpers notifs.

# clear a week of CI noise
github-helpers notifications --reason ci_activity --older-than 7 --mark-read --dry-run
github-helpers notifications --reason ci_activity --older-than 7 --mark-read -y

# permanently mute every thread in one repo
github-helpers notifications --repo owner/repo --all --unsubscribe --mark-read
Flag Description
--repo OWNER/NAME Only this repository
--reason REASON ci_activity, mention, review_requested, security_alert…
--type TYPE Issue, PullRequest, Release, Discussion, CheckSuite…
--older-than N Not updated in the last N days
--unread / --all Unread only (default), or include read
--mark-read Mark the matches as read
--unsubscribe Mute the matched threads permanently
--format text|json|csv|md Export

gh does not request the notifications scope by default: gh auth refresh -h github.com -s notifications.

--unsubscribe sets the thread to ignored rather than just dropping the subscription, because a plain unsubscribe resubscribes you on the next comment.

invite-cleanup — Pending repository and org invitations

github-helpers invite-cleanup
github-helpers invite-cleanup --accept --repo friend/project
github-helpers invite-cleanup --outgoing --org my-company --decline --older-than 60
Flag Description
--incoming / --outgoing Invitations to you (default), or ones you sent
--repo OWNER/NAME / --org NAME Restrict the scope
--older-than N Only invitations older than N days
--accept / --decline Never implicit; listing is the default

--outgoing requires --repo or --org: GraphQL exposes no outgoing-invitation connection, so a whole-account scan would cost one request per repository, while --org answers in one. There is no REST endpoint to decline an org invitation — those are reported with a link and counted as Manual.

Audit & visibility

repo-audit — Scan repos for common issues

Check repos for missing LICENSE, README, description, or topics.

github-helpers repo-audit
github-helpers repo-audit --org my-company
github-helpers repo-audit --language Shell -v
Flag Description
--user NAME / --org NAME Target (default: authenticated user)
--language LANG Filter by language
--topic TOPIC Filter by topic
--limit N Max repos to scan

stats — GitHub profile stats

Quick dashboard: repo count, total stars/forks, top languages, most starred, least active.

github-helpers stats
github-helpers stats --org my-company

workflow-status — Red CI across your repos

Alias: ci. Scans every non-archived source repo you own and reports which ones have red CI. By default it judges the checks of the head commit of the default branch, like the check mark on GitHub's commit list: the newest commit that has runs (a [skip ci] commit has none and is passed over), latest run per workflow on it. A workflow that no longer runs on the branch (trigger changed, branches-ignore, paths filter) cannot keep an old failure alive. --all-branches does the same for every branch. Red repos come first, each with its failing workflows and a link to the run.

github-helpers ci
github-helpers workflow-status --org my-company --failed
github-helpers ci --all-branches -v
github-helpers ci --repo maxgfr/github-helpers --all-branches
github-helpers ci --failed --format json | jq -r '.[] | "\(.repo)  \(.workflow)  \(.url)"'
github-helpers ci --exit-code >/dev/null 2>&1 || echo "some CI is red"   # cron / CI gate

A run is red on failure, timed_out or startup_failure, green on success, pending while queued or in progress, and other when cancelled, skipped, neutral or stale. A repo takes its worst verdict (red, then pending, green, other); a repo with no active workflow, or none that ever ran on the branch, is no-ci. Disabled workflows are ignored, so an old failure of one never counts, and runs triggered from a fork (a fork PR whose branch is also main) are ignored too. GitHub-managed "dynamic" workflows (Dependabot Updates, CodeQL default setup, Pages builds) are not your CI and never show on the branch's commits, so they are ignored unless you pass --include-dynamic.

Flag Description
--user NAME / --org NAME Target (default: authenticated user)
--repo OWNER/REPO Single repo
--include-forks Include forks (excluded by default; archived repos always are)
--limit N Max repos to scan (default: 1000; warns when the cap is hit)
--all-branches Head-commit checks of every branch, from the 100 most recent runs of each repo
--include-dynamic Also count GitHub-managed workflows (Dependabot Updates, CodeQL default setup, Pages builds)
--failed Only red repos (text) or red runs (json/csv/md)
--format text|json|csv|md Output format (default: text). Rows: repo, workflow, branch, sha, event, status, conclusion, verdict, created_at, url
--output FILE Write the report to a file
--exit-code Exit 1 when at least one repo is red
-v, --verbose Also list green, pending and other workflows under each repo

Cost: about 2 core API requests per repo with CI (workflow list + runs), 1 per repo without. Progress, the summary and skipped repos go to stderr, so --format json | jq stays clean.


secret-audit — List secrets and env vars

github-helpers secret-audit
github-helpers secret-audit --org my-company
github-helpers secret-audit --repo maxgfr/my-repo -v
Flag Description
--user NAME / --org NAME Target (default: authenticated user)
--repo OWNER/REPO Single repo
--limit N Max repos to scan

license-check — Check and add LICENSE files

github-helpers license-check
github-helpers license-check --add --template MIT --dry-run
github-helpers license-check --org my-company --add --template Apache-2.0 -y
Flag Description
--user NAME / --org NAME Target (default: authenticated user)
--add Add LICENSE to repos missing one
--template SPDX License template (e.g., MIT, Apache-2.0)

vulnerability-check — Audit Dependabot alerts

Scan repos for open Dependabot vulnerability alerts, grouped by severity.

github-helpers vulnerability-check
github-helpers vulnerability-check --org my-company --severity critical
github-helpers vulnerability-check --repo maxgfr/my-repo -v
Flag Description
--repo OWNER/REPO Single repo
--user NAME / --org NAME Target (default: authenticated user)
--severity LEVEL Filter: critical, high, medium, low
--limit N Max repos to scan

branch-protection — Audit or enforce branch protection

Check which repos lack branch protection on their default branch, and optionally enforce rules.

github-helpers branch-protection
github-helpers branch-protection --org my-company
github-helpers branch-protection --enforce --require-reviews 2 --dry-run
github-helpers branch-protection --repo maxgfr/my-repo --enforce -y
Flag Description
--repo OWNER/REPO Single repo
--user NAME / --org NAME Target (default: authenticated user)
--enforce Apply protection rules (default: audit only)
--require-reviews N Required approving reviews (default: 1)
--require-status-checks Require status checks to pass
--allow-force-push Allow force push (default: disallow)

webhook-audit — List webhooks across repos

List all configured webhooks with their URL, events, and status.

github-helpers webhook-audit
github-helpers webhook-audit --org my-company -v
github-helpers webhook-audit --repo maxgfr/my-repo
Flag Description
--repo OWNER/REPO Single repo
--user NAME / --org NAME Target (default: authenticated user)
--limit N Max repos to scan

collaborator-audit — Audit outside collaborators

List outside collaborators and their permission levels across repos.

github-helpers collaborator-audit --org my-company
github-helpers collaborator-audit --org my-company --permission admin
github-helpers collaborator-audit --user maxgfr
Flag Description
--org NAME / --user NAME Target (required)
--permission LEVEL Filter: admin, write, read
--limit N Max repos to scan

activity-report — Generate activity summary

Generate a summary of PRs, issues, and repo activity for a given period.

github-helpers activity-report
github-helpers activity-report --org my-company --since 2025-01-01
github-helpers activity-report --since 2025-06-01 --until 2025-06-30 --format json
github-helpers activity-report --user octocat --format csv
Flag Description
--user NAME / --org NAME Target (default: authenticated user)
--since DATE Start date YYYY-MM-DD (default: 30 days ago)
--until DATE End date YYYY-MM-DD (default: today)
--format FORMAT text, json, csv (default: text)

traffic — Snapshot repo views and clones

GitHub only keeps 14 days of traffic data, so the point is to build your own history.

github-helpers traffic
github-helpers traffic --sort clones --top 10
github-helpers traffic --repo me/proj --paths --referrers

# cron this: appends only rows the file does not already have
github-helpers traffic --format csv --out traffic.csv --append
Flag Description
--per day|week Granularity (default: day)
--sort views|clones Sort the summary
--top N Only the top N repos
--paths / --referrers Most visited paths, top referring sites
--format text|json|csv|md, --out FILE Export
--append Append only new (date, repo) rows — idempotent

These endpoints need push access, so repos you do not own are skipped.

org-audit — Org-level security and membership posture

github-helpers org-audit --org my-company
github-helpers org-audit --org my-company --format json | jq .summary
github-helpers org-audit --org my-company --fail-on-issues   # in CI
Check Reports
2fa_required Two-factor enforced organization-wide
2fa_members Members with two-factor disabled
owner_count Too many owners, or a bus factor of one
outside_collaborators How many, with a pointer to collaborator-audit
pending_invitations Invitations still outstanding after 30 days
default_repo_permission Base permission granted on every new repo
member_repo_creation Whether members can create public repos
teams Access managed through teams rather than per person
Exit code With --fail-on-issues
0 No problems
1 Fatal error (missing --org, org not found)
2 At least one FAIL
4 No FAIL, but a check could not run (SKIP)
3 No FAIL or SKIP, at least one WARN

SKIP outranks WARN on purpose: an incomplete audit is worse than a known warning, because you cannot know what the check that did not run would have found.

This is org-level only and never iterates repositories — that is the boundary with collaborator-audit. Several endpoints are owner-only: gh auth refresh -h github.com -s read:org,admin:org.

follow-audit — Who follows you back, and who does not

Alias: github-helpers follow. Read-only by default.

github-helpers follow-audit
github-helpers follow-audit --not-followed-by-me
github-helpers follow-audit --format csv --out follows.csv
github-helpers follow-audit --not-following-back --exclude keep.txt --unfollow --dry-run
Flag Description
--not-following-back You follow them, they do not follow you (default view)
--not-followed-by-me They follow you, you do not follow back
--mutuals Mutual follows
--exclude FILE Logins never to unfollow, one per line
--inactive N No push to a public repo of theirs in N days
--unfollow Unfollow (only with --not-following-back)
--format text|json|csv|md, --out FILE Export

--inactive measures the last push to a public repository they own. Someone working only in private repos will look inactive; it is a hint, not proof.

--exclude fails loudly if the file is missing — a silently-empty whitelist is the disaster case here. Unfollowing goes through the dry-run → edit → --from loop so a human reads every login first, and needs the user:follow scope.

inbox — What is waiting on you, across every repo

Alias: github-helpers recap. Read-only. A daily view of the issues and PRs other people opened on your repositories, without going through the notification inbox.

github-helpers inbox                                  # since your last run (7 days the first time)
github-helpers recap --since 30 --org my-company      # fixed window, your repos + an org
github-helpers inbox --only awaiting --only review --open 5
github-helpers inbox --format md --output digest.md --no-save
github-helpers inbox --format json | jq '.[] | select(.section == "review") | .url'

Each item is listed once, in the first section it matches:

Section Meaning
⏳ awaiting The last human comment is from someone who is not OWNER/MEMBER/COLLABORATOR (or nobody answered an outside issue yet)
👀 review Open PR, not a draft, no conflict, CI green or absent, and you have not reviewed it
🆕 new Opened inside the window
🏷 untriaged Issue with no label and no assignee
✎ updated Older item with activity inside the window
Flag Description
--user NAME Scan this user's repos instead of yours
--org NAME Also scan an organization (repeatable)
--repo OWNER/NAME Only this repository
--type issue|pr|all Default all
--since N|YYYY-MM-DD Fixed window instead of "since last run" (not saved)
--no-save Do not update the last-run timestamp
--label NAME Only items with this label
--archived Include archived repositories
--include-forks Include forks (excluded by default)
--include-bots List bot items instead of a one-line summary
--include-mine List items you opened yourself
--all Also list every other open item from other people, last, as "other"
--exclude-author LOGIN Treat this login as a bot (repeatable)
--only SECTION Keep only this section (repeatable)
--max-per-section N Lines per section in text mode (default 15, 0 = all)
--limit N Max results per search (default 1000)
--format text|json|csv|md, --output FILE Export; md is a paste-ready digest
--open N Open the N most urgent items in the browser (asks above 5)

It runs one paginated GraphQL search per owner and type rather than one request per repository. Known bots (Dependabot, Renovate, github-actions…) are excluded server-side and reported as a count, with a pointer to bulk-merge. GitHub search stops at 1000 results; the command warns when a search hits it or --limit.

The last-run timestamp is stored per scope (owners + type + label) in ${XDG_STATE_HOME:-~/.local/state}/github-helpers/inbox.json. It records the start of the run, so nothing opened during the scan is missed, and it is only written after a complete scan: a skipped owner, --since, --only or --no-save leave it untouched.

branches — Track open branches across your repos

Alias: github-helpers branch-status. Read-only. Every branch other than the default one, on every non-archived source repo, with how many commits it is ahead of and behind the default branch, its last PR, and what cleanup-branches would do with it.

github-helpers branches
github-helpers branches --org my-company --stale-days 90
github-helpers branch-status --repo maxgfr/github-helpers
github-helpers branches --format json | jq '.[] | select(.behind > 50)'
maxgfr/github-helpers  (main)
  feat/foo      ↑3    ↓12       4d  #42 open      ACTIVE
  wip/squashed  ↑5    ↓8       20d  #38 merged    PR_MERGED
  fix/old       ↑0    ↓40      90d  —             MERGED
─────────────────────────────────────────────
  14 branch(es) in 5 repo(s): 6 active · 2 open PR · 5 cleanable · 1 protected
  → github-helpers cleanup-branches --dry-run
Verdict (first match wins) Meaning
PROTECTED Covered by a branch protection rule
OPEN_PR Head or base of an open pull request
UNKNOWN Could not be compared or verified
MERGED No commit ahead of the default branch
PR_MERGED Last PR merged, branch unchanged since (squash or rebase merge)
PR_CLOSED Last PR closed unmerged, branch unchanged since
STALE Only with --stale-days N: no commit in N days
ACTIVE Everything else, including commits pushed after a merged PR
Flag Description
--user NAME / --org NAME Owner to scan (default: you)
--repo OWNER/NAME Only this repository
--stale-days N Label branches untouched for N days as STALE
--exclude REGEX Hide branches matching REGEX
--limit N Max repos to scan (default: 1000)
--format text|json|csv|md, --output FILE Export

One GraphQL request covers 10 repositories: branches, comparisons and PRs together. Only the first 100 branches of a repo are listed, and the command says so when that happens.

status — Login, token and API rate limits

Read-only. Who gh is logged in as, whether the token works, its scopes, and what is left of each API quota with its reset time. It reads GET /rate_limit, which does not count against any quota, so it still answers when every other command is blocked.

github-helpers status
github-helpers status --all
github-helpers status --format json | jq '.rate_limits[] | select(.remaining == 0)'
  Account: maxgfr (token from keyring)
  Token:   valid, but the core quota is exhausted
  Scopes:  not checked (core quota exhausted)

  BUCKET                    USED REMAINING   LIMIT  RESETS
  core                      5000         0    5000  22:30 (in 14 min)
  graphql                     13      4987    5000  23:05 (in 49 min)
  search                       0        30      30  -
  code_search                  0        10      10  -
Flag Description
--all Every bucket, not only core, graphql, search, code_search and the used ones
--format text|json|csv|md Export (csv and md list the buckets)

The REST quota (core, 5000 requests an hour) is shared by everything that uses your account: gh, scripts, agents, editors. When it runs out, every command stops with the reset time instead of a misleading "not logged in".

Bulk operations

clone-org — Clone all repos from a GitHub org or user

github-helpers clone-org --org my-company --ssh --not-archived
github-helpers clone-org --user octocat --source --language Go
github-helpers clone-org --org my-company --dir ~/projects --pull
Flag Description
--org NAME / --user NAME Target (one required)
--dir PATH Clone destination (default: .)
--ssh Clone via SSH instead of HTTPS
--pull Pull existing repos instead of skipping
--archived / --not-archived Filter by archive status
--fork / --source Filter by fork status
--visibility TYPE public, private, or internal
--language LANG Filter by primary language
--topic TOPIC Filter by topic
--limit N Max repos to clone

bulk-topic — Add or remove topics in batch

github-helpers bulk-topic --add shell --language Shell --dry-run
github-helpers bulk-topic --remove deprecated --topic deprecated -y
github-helpers bulk-topic --add cli --pattern "^maxgfr/(git-|package-)" --dry-run
Flag Description
--add TOPIC Add topic to matching repos
--remove TOPIC Remove topic from matching repos
--user NAME / --org NAME Target (default: authenticated user)
--language LANG Filter by language
--topic TOPIC Filter by existing topic
--pattern PATTERN Filter by name (grep regex)

sync-labels — Sync issue labels from a template repo

github-helpers sync-labels --from maxgfr/template --to maxgfr/my-repo --dry-run
github-helpers sync-labels --from maxgfr/template --org my-company -y
Flag Description
--from OWNER/REPO Source repo with template labels
--to OWNER/REPO Single target repo
--org NAME / --user NAME Apply to all repos

export-stars — Export starred repos

github-helpers export-stars --format json --out stars.json
github-helpers export-stars --format csv --out stars.csv
github-helpers export-stars --format md
Flag Description
--format FORMAT json, csv, or md (default: json)
--out FILE Output file (default: stdout)

rename-default-branch — Rename default branch across repos

github-helpers rename-default-branch --from master --to main --dry-run
github-helpers rename-default-branch --org my-company --dry-run
github-helpers rename-default-branch --repo maxgfr/old-repo -y
Flag Description
--from NAME Current branch name (default: master)
--to NAME New branch name (default: main)
--repo OWNER/REPO Single repo
--user NAME / --org NAME Target (default: authenticated user)

dependabot-enable — Enable Dependabot on repos

github-helpers dependabot-enable --dry-run
github-helpers dependabot-enable --ecosystems npm,github-actions --schedule weekly
github-helpers dependabot-enable --org my-company -y
Flag Description
--user NAME / --org NAME Target (default: authenticated user)
--ecosystems LIST Comma-separated ecosystems (default: auto-detect)
--schedule FREQ daily, weekly, monthly (default: weekly)

mirror — Mirror repos to another remote

github-helpers mirror --repo maxgfr/my-repo --target "git@gitlab.com:maxgfr/{name}.git" --dry-run
github-helpers mirror --user maxgfr --target "git@gitlab.com:maxgfr/{name}.git" -y
Flag Description
--repo OWNER/REPO Single repo
--user NAME / --org NAME All repos from user/org
--target URL Target URL template with {name} placeholder
--dir PATH Temp directory for bare clones

bulk-settings — Apply repo settings in batch

Enable or disable repo features in bulk: wiki, issues, projects, discussions, auto-merge, delete-branch-on-merge.

github-helpers bulk-settings --disable-wiki --language TypeScript --dry-run
github-helpers bulk-settings --enable-delete-branch --enable-auto-merge --org my-company
github-helpers bulk-settings --disable-projects --disable-wiki --topic archived --dry-run
Flag Description
--enable-wiki / --disable-wiki Toggle wiki
--enable-issues / --disable-issues Toggle issues
--enable-projects / --disable-projects Toggle projects
--enable-discussions / --disable-discussions Toggle discussions
--enable-auto-merge / --disable-auto-merge Toggle auto-merge
--enable-delete-branch / --disable-delete-branch Toggle delete branch on merge
--user NAME / --org NAME Target (default: authenticated user)
--language LANG Filter by language
--topic TOPIC Filter by topic
--pattern PATTERN Filter by repo name (grep regex)

repo-template — Sync settings from a template repo

Copy settings, labels, and/or branch protection rules from a template repo to other repos.

github-helpers repo-template --from maxgfr/template --sync-labels --dry-run
github-helpers repo-template --from maxgfr/template --all --org my-company
github-helpers repo-template --from maxgfr/template --sync-settings --topic typescript
Flag Description
--from OWNER/REPO Template repo (required)
--user NAME / --org NAME Target (default: authenticated user)
--sync-settings Sync repo settings
--sync-labels Sync issue labels
--sync-protection Sync branch protection rules
--all Sync everything
--language LANG Filter target repos by language
--topic TOPIC Filter target repos by topic

bulk-merge — Merge green dependency-update PRs in batch

github-helpers bulk-merge --dry-run
github-helpers bulk-merge --patch-only --delete-branch -y
github-helpers bulk-merge --author app/renovate --minor-only --dry-run
Flag Description
--author LOGIN PR author (default: app/dependabot)
--label NAME / --title-match REGEX Narrow the selection
--patch-only / --minor-only Filter by the semver bump in the title
--max N Max PRs merged per repo (default: 10)
--strategy squash|merge|rebase Merge strategy (default: squash)
--delete-branch Delete the head branch after merging
--no-checks Merge even when checks have not passed (dangerous)
--allow-unstable Allow UNSTABLE (non-required checks failing)

This writes to default branches. Checks must pass unless you pass --no-checks, drafts are always skipped, and only mergeStateStatus == CLEAN is merged — DIRTY, BLOCKED, BEHIND and UNKNOWN never are. Every PR is listed before the single confirmation. Titles whose bump cannot be parsed count as unknown, which both --patch-only and --minor-only exclude.

backup — Export repos and their metadata locally

github-helpers backup --repo me/proj --out /tmp/bk
github-helpers backup --gists
github-helpers backup --org my-company --mirror --out /backups/org
github-helpers backup --verify /tmp/bk
Flag Description
--out DIR Destination (default: github-backup-YYYY-MM-DD)
--no-git / --no-metadata Take only one half
--mirror Keep a bare mirror instead of a bundle
--gists Also back up your gists
--assets Also download release binaries (can be large)
--include-forks Include forks (excluded by default)
--resume Skip repos already recorded as done
--verify DIR Check an existing backup against its manifest
DIR/manifest.json                 counts, timestamps, sha256 per file
DIR/.repos.jsonl                  append-only journal, drives --resume
DIR/<owner>/<repo>/repo.bundle    git history (or repo.git/ with --mirror)
DIR/<owner>/<repo>/issues.json    issues only, pull requests stripped out
DIR/<owner>/<repo>/issue_comments.json, review_comments.json, pulls.json, …

issues.json holds the opening message but not the thread — the conversation lives in issue_comments.json and review_comments.json, the biggest omission in a naive backup.

Every file is written as .part and renamed on success, so the presence of a final file proves the write completed; that is what makes --resume safe. --verify re-checks every sha256 and exits 2 on any missing or mismatched file.

Not included: Git LFS objects, release binaries (unless --assets), Actions logs, Projects, Discussions and Packages.

download — A local copy of every repo you can access

For the day GitHub is down, gone, or locks you out. By default it takes everything your token can reach — your own repos, every organization you belong to, and the repos you collaborate on, public and private — in one sweep. Rerun it (a nightly cron works) and it only fetches what changed.

github-helpers download --dry-run                           # what, how many, how big
github-helpers download --dir ~/github-archive -y           # clone everything; rerun to refresh
github-helpers download --org my-company --not-archived     # one organization
github-helpers download --user octocat --source --checkout  # someone else's public repos
github-helpers dl --mine --wikis                            # only yours, with wikis
Flag Description
--mine Only repos you own
--org NAME / --user NAME Only these owners (repeatable). Another user's private repos are never listed
--repo OWNER/NAME A single repo
--dir PATH Destination (default: ./github-repos)
--checkout Normal clones with a working tree instead of bare mirrors
--wikis Also download wikis that have content
--archived / --not-archived Filter by archive status
--fork / --source Filter by fork status
--visibility TYPE public, private, or internal
--limit N Max repos (says so when it caps the list)
DIR/<owner>/<repo>.git         bare mirror: every branch, tag and pull-request ref
DIR/<owner>/<repo>/            with --checkout
DIR/<owner>/<repo>.wiki.git    with --wikis
DIR/index.json                 every repo, its visibility, last sync and status

Restore with git clone DIR/<owner>/<repo>.git. Clones and fetches go over HTTPS with your gh token, so private repos work without gh auth setup-git or an SSH key.

It never deletes anything local. Branches deleted on GitHub stay in the mirror, and repos that disappeared from GitHub (deleted, renamed, access lost) are listed at the end of the run and kept — your copy may be the last one. Exits 2 if any repo failed.

download vs backup vs clone-org: download is the always-current copy of all your code, across every owner; backup is a dated snapshot of one owner that also saves issues, PRs and releases; clone-org is working copies of one owner for day-to-day work.

Not included: Git LFS objects, issues/PRs/releases (use backup).

Common flags

All commands support these flags:

Flag Description
--no-color Disable colored output (also respects NO_COLOR env var)
--dry-run Preview changes without applying
-y, --yes Skip confirmation prompt
-v, --verbose Detailed output
-h, --help Show help

License

MIT

About

GitHub maintenance toolkit: bulk unstar, org clone, cleanup forks, audit repos, and more

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages