GitHub Integration Basics
8 examples to get you started with GitHub Integration & CI - 5 basic and 3 intermediate.
Search across all documentation pages
8 examples to get you started with GitHub Integration & CI - 5 basic and 3 intermediate.
gh CLI (GitHub's official command-line tool) - brew install gh on macOS, or see GitHub's install docs for your platform.gh auth login, following the interactive prompts to connect your GitHub account.gh and git commands resolve correctly.gh and git commands the same way you would type them yourself.Confirm gh is installed and authenticated before asking Claude Code to use it.
gh auth statusgh auth login and anytime a session's GitHub commands unexpectedly fail.List open pull requests before asking Claude Code to act on one of them.
gh pr list--state all to include merged and closed PRs in the list.Ask Claude Code to commit staged changes and open a PR in one step.
git add -A
git commit -m "Add rate limiting to the search endpoint"
gh pr create --title "Add rate limiting to the search endpoint" --body "Fixes #482"gh pr create opens the PR against the repository's default base branch unless you pass --base.--title and --body skip the interactive prompt so the command runs cleanly inside a session.Pull the full context of one PR before asking Claude Code to review or update it.
gh pr view 482--comments to include the review comment thread in the output.Pull a PR's branch into your working directory so Claude Code can edit its files directly.
gh pr checkout 482git status afterward to confirm you're on the expected branch before making changes.Fetch a PR's review comments, then ask Claude Code to address them and push a follow-up commit.
gh pr view 482 --comments
# Ask Claude Code: "Address the review comments on PR #482 and push a fix."
git add -A
git commit -m "Address review feedback: validate rate limit window bounds"
git pushgh pr view --comments surfaces the reviewer's exact wording so Claude Code can address each point specifically.Related: Responding to PR Review Comments Automatically - the full workflow this example previews.
Invoke Claude Code non-interactively to summarize a PR, useful as a first step toward CI automation.
claude -p "Summarize the changes in PR #482 and flag any obvious risks." --output-format text-p (print mode) runs one prompt and exits, without opening the interactive REPL.Related: Headless Mode Explained: Running Claude Code Without a Terminal - how this mode works in depth.
Post a comment directly to a PR from the command line, the same call a CI job would make.
gh pr comment 482 --body "Looks good overall - one suggestion: consider caching the rate-limit window lookup."gh pr comment posts a top-level comment on the PR's conversation thread.Related: Running Claude Code as an Automated Code Review Bot in CI - wiring this into a real CI job.
Stack versions: Written against the Claude model lineup current as of ~June 2026 - Claude Fable 5, Claude Opus 4.8, Claude Sonnet 5 (the default), and Claude Haiku 4.5. Model names, pricing, and product features move quickly - verify current specifics at platform.claude.com/docs before relying on them.
Reviewed by Chris St. John·Last updated Jul 18, 2026