| name | github-cli |
| description | Manage repositories, CI/CD workflows, issues, pull requests, and releases using the GitHub CLI. Use when automating GitHub operations, managing repositories via command line, or integrating GitHub workflows into development processes. |
| license | MIT |
| compatibility | agents |
| metadata | {"audience":"developers, devops, github-users","domain":"version-control, automation"} |
GitHub CLI Skill
This skill provides comprehensive guidance for using the GitHub CLI (gh) to manage repositories, CI/CD workflows, issues, pull requests, and releases.
What I do
Execute GitHub operations efficiently via command line for repository management, CI/CD automation, issue tracking, and release management.
When to use me
- Manage repositories from the command line
- Automate GitHub Actions workflows
- Handle issues and pull requests programmatically
- Create and manage releases
- Batch GitHub operations
- Use GitHub API with the CLI
Core Operations
Prerequisites
gh CLI installed and authenticated
- Run
gh auth status to verify authentication
Repository Management
gh repo list [owner] --limit 50
gh repo list --source
gh repo list --fork
gh repo view [repo]
gh repo view --web
gh repo create <name> --public
gh repo create <name> --private
gh repo create <name> --clone
gh repo create <name> --template <repo>
gh repo clone <repo>
gh repo clone <repo> -- --depth 1
gh repo fork <repo>
gh repo fork <repo> --clone
gh repo delete <repo> --yes
gh repo archive <repo>
gh repo unarchive <repo>
gh repo edit --default-branch main
gh repo edit --visibility public
gh repo edit --enable-issues=false
Pull Requests
gh pr list
gh pr list --state all
gh pr list --author @me
gh pr list --search "is:open draft:false"
gh pr view [number]
gh pr view --web
gh pr view --comments
gh pr create
gh pr create --title "Title" --body "Description"
gh pr create --draft
gh pr create --base main --head feature
gh pr create --fill
gh pr review [number] --approve
gh pr review [number] --request-changes --body "Comments"
gh pr review [number] --comment --body "LGTM"
gh pr merge [number]
gh pr merge --merge
gh pr merge --squash
gh pr merge --rebase
gh pr merge --auto
gh pr merge --delete-branch
gh pr checkout [number]
gh pr ready [number]
gh pr close [number]
gh pr reopen [number]
gh pr diff [number]
gh pr checks [number]
Issues
gh issue list
gh issue list --state all
gh issue list --label "bug"
gh issue list --assignee @me
gh issue list --search "is:open label:urgent"
gh issue view [number]
gh issue view --web
gh issue view --comments
gh issue create
gh issue create --title "Title" --body "Description"
gh issue create --label "bug,urgent"
gh issue create --assignee "@me,user2"
gh issue create --milestone "v1.0"
gh issue edit [number] --title "New title"
gh issue edit [number] --add-label "priority"
gh issue edit [number] --remove-label "wontfix"
gh issue edit [number] --add-assignee "user"
gh issue close [number]
gh issue close [number] --reason "not planned"
gh issue reopen [number]
gh issue transfer [number] <destination-repo>
gh issue pin [number]
gh issue unpin [number]
GitHub Actions (Workflows)
gh workflow list
gh workflow list --all
gh workflow view [workflow-id|name]
gh workflow view --web
gh workflow run [workflow]
gh workflow run [workflow] --ref branch-name
gh workflow run [workflow] -f param1=value1 -f param2=value2
gh workflow enable [workflow]
gh workflow disable [workflow]
gh run list
gh run list --workflow [workflow]
gh run list --branch main
gh run list --status failure
gh run list --user @me
gh run view [run-id]
gh run view --web
gh run view --log
gh run view --log-failed
gh run watch [run-id]
gh run rerun [run-id]
gh run rerun [run-id] --failed
gh run rerun [run-id] --debug
gh run cancel [run-id]
gh run download [run-id]
gh run download [run-id] -n artifact-name
Releases
gh release list
gh release list --exclude-drafts
gh release view [tag]
gh release view --web
gh release create <tag>
gh release create <tag> --title "Title" --notes "Notes"
gh release create <tag> --generate-notes
gh release create <tag> --draft
gh release create <tag> --prerelease
gh release create <tag> ./dist/*
gh release edit <tag> --title "New title"
gh release edit <tag> --draft=false
gh release delete <tag>
gh release delete <tag> --cleanup-tag
gh release download <tag>
gh release download <tag> -p "*.zip"
gh release upload <tag> ./file.zip
Gists
gh gist list
gh gist list --public
gh gist list --secret
gh gist view [gist-id]
gh gist view --web
gh gist create file.txt
gh gist create file1.txt file2.txt
gh gist create --public file.txt
gh gist create -d "Description" file.txt
gh gist edit [gist-id]
gh gist edit [gist-id] -a newfile.txt
gh gist delete [gist-id]
gh gist clone [gist-id]
GitHub API Direct Access
gh api repos/{owner}/{repo}
gh api /user
gh api orgs/{org}/repos --paginate
gh api repos/{owner}/{repo}/issues -f title="Bug" -f body="Description"
gh api repos/{owner}/{repo}/labels --input data.json
gh api graphql -f query='{ viewer { login } }'
gh api repos/{owner}/{repo} --jq '.name'
gh api repos/{owner}/{repo} -t '{{.name}}'
Labels
gh label list
gh label create "priority:high" --color FF0000 --description "High priority"
gh label edit "old-name" --name "new-name"
gh label edit "bug" --color 00FF00
gh label delete "label-name"
gh label clone source-repo
SSH Keys & GPG Keys
gh ssh-key list
gh ssh-key add ~/.ssh/id_rsa.pub --title "My Key"
gh ssh-key delete [key-id]
gh gpg-key list
gh gpg-key add key.gpg
Common Patterns
Batch Operations
gh issue list --label "wontfix" --json number --jq '.[].number' | \
xargs -I {} gh issue close {}
gh release list --json tagName,isDraft --jq '.[] | select(.isDraft) | .tagName' | \
xargs -I {} gh release delete {} --yes
gh pr list --author "app/dependabot" --json number --jq '.[].number' | \
xargs -I {} sh -c 'gh pr review {} --approve && gh pr merge {} --squash'
JSON Output and Filtering
gh pr list --json number,title,author
gh issue list --json number,title,labels --jq '.[] | {num: .number, title: .title}'
gh pr list --json number,title,mergeable --jq '.[] | select(.mergeable == "MERGEABLE")'
Cross-Repository Operations
gh pr list -R owner/repo
gh issue create -R owner/repo --title "Title"
gh workflow run -R owner/repo workflow.yml
Troubleshooting
gh auth status
gh auth refresh
gh auth login --scopes "repo,workflow,admin:org"
GH_DEBUG=1 gh <command>
gh api rate_limit
Reference
For detailed command reference including all flags and options, see references/gh-commands.md.