A SwiftBar plugin that shows GitHub pull requests waiting on you, right in the macOS menu bar:
- Needs Review — open PRs that requested your review and aren't approved yet.
- Reviewed — open PRs you've already reviewed (e.g. left comments or requested changes) that aren't approved yet. GitHub drops you from the review-requested list once you submit a review, so these would otherwise disappear.
- Approved — open PRs assigned to you that have been approved.
Each entry links straight to the PR and shows how long it's been open. The token is read from the macOS Keychain, so it never lives in the script.
- macOS with SwiftBar installed
(
brew install swiftbar) - Python 3 — the plugin uses the system
/usr/bin/python3and the standard library only, so there's nothing extra to install.
Generate a token at
github.com/settings/tokens. A classic
token with the repo scope (or a fine-grained token with read access to pull
requests) is enough.
Save it as a generic password. Pick any account/service names you like — just remember them for the next step:
security add-generic-password \
-a "your-keychain-account" \
-s "your-keychain-token" \
-w "ghp_yourGeneratedToken"-ais the account (maps toKEYCHAIN_ACCOUNTin the script)-sis the service (maps toKEYCHAIN_TOKENin the script)-wis the token value
Edit the constants at the top of fetch-prs.5m.py so they match your GitHub
username and the names you used above:
GITHUB_USERNAME = "your-github-username"
KEYCHAIN_ACCOUNT = "your-keychain-account"
KEYCHAIN_TOKEN = "your-keychain-token"Copy the script into your SwiftBar plugins folder and make it executable:
chmod +x fetch-prs.5m.pyThen refresh SwiftBar (menu bar → SwiftBar → Refresh All, or just quit and
reopen). The 5m in the filename sets the refresh interval — rename it to taste,
e.g. fetch-prs.1m.py for every minute.
