This skill should be used when users need to interact with GitHub via the gh CLI. It covers repository management (create, delete, clone, fork), CI/CD workflows (GitHub Actions), Issues, Pull Requests, Releases, and other GitHub operations. Triggers on requests mentioning GitHub, repos, PRs, issues, actions, or workflows.
This skill provides comprehensive guidance for using the GitHub CLI (gh) to manage repositories, CI/CD workflows, issues, pull requests, and releases.
gh CLI is installed and the user is already authenticated with their GitHub account. No login or authentication steps are required.# List repositories
gh repo list [owner] --limit 50
# View repository
gh repo view [repo]
gh repo view --web # Open in browser
# Create repository
gh repo create <name> --public # Public repo
gh repo create <name> --private # Private repo
gh repo create <name> --clone # Create and clone locally
gh repo create <name> --template <repo> # From template
# Clone repository
gh repo clone <repo>
gh repo clone <repo> -- --depth 1 # Shallow clone
# Fork repository
gh repo fork <repo> --clone # Fork and clone
# Rename repository
gh repo rename <new-name>
# Sync fork with upstream
gh repo sync # Sync default branch
gh repo sync --branch main # Sync specific branch
# Edit repository settings
gh repo edit --default-branch main
gh repo edit --visibility public
# Delete repository
gh repo delete <repo> --yes
# List PRs
gh pr list
gh pr list --state all # All states
gh pr list --author @me # My PRs
gh pr list --search "is:open draft:false"
# View PR
gh pr view [number]
gh pr view --web # Open in browser
gh pr view --comments # Show comments
# Create PR
gh pr create --title "Title" --body "Description"
gh pr create --draft # Create as draft
gh pr create --base main --head feature # Specify branches
gh pr create --fill # Auto-fill from commits
# Edit PR
gh pr edit [number] --title "New title"
gh pr edit [number] --add-label "bug" --remove-label "wip"
gh pr edit [number] --add-reviewer "username"
gh pr edit [number] --base main # Change base branch
# Review PR
gh pr review [number] --approve
gh pr review [number] --request-changes --body "Comments"
gh pr review [number] --comment --body "LGTM"
# Merge PR
gh pr merge [number] --squash --delete-branch # Most common pattern
gh pr merge [number] --merge # Merge commit
gh pr merge [number] --rebase # Rebase and merge
gh pr merge [number] --auto # Enable auto-merge
# Other PR operations
gh pr checkout [number] # Checkout PR locally
gh pr ready [number] # Mark draft as ready
gh pr close [number]
gh pr reopen [number]
gh pr diff [number]
gh pr checks [number] # View CI status
# List 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"
# View issue
gh issue view [number]
gh issue view --web
gh issue view --comments
# Create issue
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"
# Edit issue
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"
# Close/Reopen
gh issue close [number]
gh issue close [number] --reason "not planned"
gh issue reopen [number]
# List and view workflows
gh workflow list
gh workflow list --all # Include disabled workflows
gh workflow view [workflow-id|name]
# Trigger a workflow manually
gh workflow run [workflow]
gh workflow run [workflow] --ref branch-name
gh workflow run [workflow] -f key=value # Pass inputs
# Enable/Disable workflow
gh workflow enable [workflow]
gh workflow disable [workflow]
# List runs
gh run list
gh run list --workflow [workflow]
gh run list --branch main
gh run list --status failure # Filter by status
# View run details and logs
gh run view [run-id]
gh run view [run-id] --log # Full logs
gh run view [run-id] --log-failed # Only failed step logs
# Watch a run in real time
gh run watch [run-id]
# Rerun / Cancel
gh run rerun [run-id]
gh run rerun [run-id] --failed # Only failed jobs
gh run cancel [run-id]
# List and view releases
gh release list
gh release view [tag]
gh release view --web
# Create release
gh release create <tag> --title "Title" --notes "Notes"
gh release create <tag> --generate-notes # Auto-generate from commits
gh release create <tag> --draft # Create as draft first
gh release create <tag> --prerelease
gh release create <tag> ./dist/* # Attach assets
# Edit release
gh release edit <tag> --title "New title"
gh release edit <tag> --draft=false # Publish a draft
# Delete release
gh release delete <tag> --yes
gh release delete <tag> --cleanup-tag --yes # Also delete the git tag
# Download assets
gh release download <tag>
gh release download <tag> -p "*.zip" # Pattern match
# List labels
gh label list
# Create label
gh label create "bug" --color FF0000 --description "Something broken"
# Delete label
gh label delete "label-name"
# Search repositories
gh search repos <query>
gh search repos <query> --language python --stars ">100"
gh search repos <query> --sort stars --order desc
# Search issues & PRs
gh search issues <query> --assignee @me --state open
gh search issues <query> --label "bug"
gh search prs <query> --review required --base main
# Search code
gh search code <query>
gh search code <query> --language go --owner myorg
gh search code <query> --filename config --extension yaml
# Common flags (work on all search commands)
# --json <fields> Output JSON
# --jq <expr> Filter JSON output
# --limit <int> Max results (default 30)
# --web Open results in browser
# GET request
gh api repos/{owner}/{repo}
gh api orgs/{org}/repos --paginate
# POST / write operations
gh api repos/{owner}/{repo}/issues -f title="Bug" -f body="Description"
gh api repos/{owner}/{repo}/labels --input data.json
# GraphQL
gh api graphql -f query='{ viewer { login } }'
# Filter output with jq
gh api repos/{owner}/{repo} --jq '.name'
# Select specific fields
gh pr list --json number,title,author
gh issue list --json number,title,labels --jq '.[] | {num: .number, title: .title}'
# Filter with a condition
gh pr list --json number,title,mergeable --jq '.[] | select(.mergeable == "MERGEABLE")'
# Any command can target a specific repo with -R
gh pr list -R owner/repo
gh issue create -R owner/repo --title "Title"
gh workflow run -R owner/repo workflow.yml
gh release list -R owner/repo
# See all open PRs, assigned issues, and review requests across repos
gh status
Authentication: The user is already logged in to their GitHub account. No authentication commands are needed.
# Check API rate limit
gh api rate_limit