Using Gh Cli
Automate and integrate GitHub CLI workflows for efficient repository and project management
Using GH CLI is a community skill for automating GitHub workflows with the GitHub CLI, covering repository management, pull request operations, issue tracking, Actions workflows, and API queries for efficient developer command-line productivity.
What Is This?
Overview
Using GH CLI provides guidance on performing GitHub operations directly from the terminal using the gh command-line tool. It covers repository management that creates, clones, forks, and configures repositories with visibility and template settings, pull request operations that create, review, merge, and manage PRs with labels, reviewers, and draft status from the command line, issue tracking that creates, lists, filters, and closes issues with assignees, labels, and milestone associations, Actions workflow management that triggers, monitors, and debugs CI/CD pipeline runs with log retrieval and artifact downloads, and API queries that access any GitHub REST or GraphQL endpoint for custom automation scripts. The skill helps developers manage GitHub without leaving their terminal environment, reducing context switching and keeping focus within a single workflow.
Who Should Use This
This skill serves developers automating their GitHub workflow from the terminal, DevOps engineers scripting repository management tasks, and security auditors reviewing repository settings and access configurations. Teams adopting GitOps practices will also find the CLI valuable for integrating GitHub operations into shell-based pipelines.
Why Use It?
Problems It Solves
Switching between terminal and browser interrupts development flow for routine GitHub tasks. Automating PR creation with consistent labels and reviewers requires scripting the GitHub API directly. Monitoring CI pipeline status needs repeated web interface checks. Bulk operations across multiple repositories require API scripting that the CLI simplifies with built-in authentication and context-aware defaults that detect the current repository automatically.
Core Highlights
PR manager creates and reviews pull requests from terminal. Issue tracker manages bugs and features with filtering. Actions monitor watches CI runs and retrieves logs. API client queries any GitHub endpoint with authentication.
How to Use It?
Basic Usage
gh pr create \
--title "Add auth module" \
--body "Implements OAuth" \
--label "feature" \
--reviewer "teammate"
gh pr list \
--state open \
--label "needs-review"
gh pr review 42 \
--approve
gh pr merge 42 \
--squash \
--delete-branch
gh pr checks 42Real-World Examples
gh issue create \
--title "Fix login bug" \
--body "Steps to repro" \
--label "bug,priority" \
--assignee "@me"
gh run watch \
--exit-status
gh run download 12345 \
--name "build-output"
gh api \
repos/{owner}/{repo}\
/contributors \
--jq '.[].login'
gh api graphql -f query='
{ viewer {
repositories(
first: 5,
orderBy: {
field: UPDATED_AT,
direction: DESC}
) { nodes { name } }
}}'Advanced Tips
Use gh alias to create shorthand commands for frequently used complex operations. For example, aliasing a PR creation command with your team's standard labels saves repetitive typing. Pipe gh api output through jq for structured data extraction in automation scripts. Set up gh auth login with a token for CI environments where interactive authentication is not possible.
When to Use It?
Use Cases
Automate PR creation with consistent labels and reviewer assignments in a team workflow. Script bulk issue management across multiple repositories for project tracking. Monitor GitHub Actions pipeline runs and download artifacts from the terminal.
Related Topics
GitHub, CLI tools, pull requests, issues, GitHub Actions, REST API, GraphQL, and developer productivity.
Important Notes
Requirements
GitHub CLI installed and authenticated with gh auth login for accessing repository operations and API endpoints. Git repository context for commands that operate on the current repository such as PR creation and issue listing. GitHub account with appropriate permissions for the target repositories and organizations.
Usage Recommendations
Do: use gh aliases for complex commands that you run frequently to reduce typing and errors. Leverage the --jq flag with API commands to extract specific fields from JSON responses. Authenticate with fine-grained personal access tokens scoped to required permissions only, limiting exposure if a token is ever compromised.
Don't: hardcode repository names in scripts when gh can detect the current repository from git context. Ignore exit codes from gh commands in automation scripts since failures should be handled explicitly. Store authentication tokens in plaintext files when gh auth manages credentials securely through the system keychain.
Limitations
Some GitHub features like detailed code review comments are easier to manage through the web interface than the CLI. Complex GraphQL queries require understanding the GitHub schema which has a learning curve. Rate limits on the GitHub API apply to CLI requests and may throttle heavy automation scripts.
More Skills You Might Like
Explore similar skills to enhance your workflow
Detrack Automation
Automate Detrack operations through Composio's Detrack toolkit via Rube
Media
Manage digital media assets and automate multimedia processing and integration
Senior Secops
Senior SecOps automation and integration for advanced security operations management
google-search
Search the web using Google Custom Search Engine (PSE). Use this when you need live information
Mailersend Automation
Automate Mailersend operations through Composio's Mailersend toolkit
Text To Speech
Convert text to natural-sounding speech with seamless automation and integration