$ command-helper

GitHub CLI (gh)

Pull requests, checking out and reviewing, CI runs and logs, issues, releases and raw API calls.

Requires Google sign-in

Setup

Log in
gh auth login
Clone a repository
gh repo clone <gh_repo>
Open the repo in the browser
gh browse

Pull requests

Create a PR from the current branch
gh pr create --fill
Create a draft PR
gh pr create --draft --title "<pr_title>" --body ""
My open PRs and review requests
gh pr status
Check out someone's PR locally
gh pr checkout <pr_number>
Show the PR diff
gh pr diff <pr_number>
Approve
gh pr review <pr_number> --approve
Squash-merge and delete the branch
gh pr merge <pr_number> --squash --delete-branch
Wait for checks to finishadvanced
gh pr checks <pr_number> --watch

CI (GitHub Actions)

Recent workflow runs
gh run list --limit 10
Follow a run live
gh run watch
Logs of failed steps only
gh run view <run_id> --log-failed
Re-run failed jobs
gh run rerun <run_id> --failed
Trigger a workflow manuallyadvanced
gh workflow run <workflow>.yml --ref main -f environment=staging
Set a repository secretadvanced
gh secret set <gh_secret> < secret.txt

Issues, releases, API

Issues assigned to me
gh issue list --assignee @me
Create a release with generated notes
gh release create <git_tag> --generate-notes
Call any API endpointadvanced
gh api repos/<gh_repo>/pulls --jq '.[].title'