GitHub Workflow Automation
Using Claude Code as a GitHub-integrated agent for PRs, issues, and repository context.
The Claude GitHub App
Claude Code integrates directly with GitHub through a dedicated GitHub App. Once installed on a repository, Claude can be triggered by events like issue creation or PR comments. This shifts Claude from a local coding assistant to a CI/CD-integrated automation agent that responds to repository events.
Setting Up the Integration
- ▸Install the Claude Code GitHub App on your repository from the GitHub Marketplace
- ▸Configure repository permissions — Claude needs read/write access to code, issues, and pull requests
- ▸The integration uses GitHub Actions as the execution environment for Claude
- ▸A workflow file (.github/workflows/) defines when and how Claude is triggered
Automated Pull Request Creation
When triggered, Claude Code follows a structured workflow: it creates a to-do list from the task description, reads relevant files, generates a plan, implements changes, and opens a pull request — all without human intervention. The PR includes a description of what was changed and why.
Resolving GitHub Issues Automatically
Claude can be assigned to GitHub issues directly. When triggered, it performs context discovery — reading the issue description, exploring relevant code, and building a mental model of the change needed. It then proposes changes and submits them as a PR linked to the original issue.
| Step | What Claude Does |
|---|---|
| Context Discovery | Reads issue description, explores referenced files and related code |
| Planning | Creates internal to-do list, identifies files to modify |
| Implementation | Makes code changes following project conventions from CLAUDE.md |
| Submission | Opens a PR with a summary, links it to the issue |
Repository Context with CLAUDE.md
The CLAUDE.md file becomes critical in CI/CD contexts. When Claude runs in a GitHub Action, it has no prior conversation history — CLAUDE.md is the only persistent context available. A well-crafted CLAUDE.md ensures that automated runs follow the same conventions, architecture decisions, and coding standards as interactive sessions.
# CLAUDE.md — used by both local and CI/CD Claude sessions
## Architecture
- Next.js App Router with TypeScript
- Tailwind CSS for styling, no CSS modules
- All API routes in app/api/
## Conventions
- Use server components by default
- Client components only when interactivity is required
- Run `npm run lint` before committing
## Testing
- Jest for unit tests, Playwright for e2e
- Test files colocated with source: foo.test.tsInitialize your CLAUDE.md with /init before setting up GitHub automation. This ensures Claude has the context it needs to make changes that align with your project's conventions, even when running unattended in CI.
Reviewing Claude's Automated Changes
Automated PRs from Claude should be treated like PRs from any team member — review the diff, check for correctness, and validate that the changes solve the original issue. Claude's workflow includes reading existing code and following project conventions, but human review remains the final quality gate.