Skip to content

Automate issue-to-PR pipeline with Claude Code GitHub Actions

pattern

Manual code review and PR creation slows development; want an automated issue-to-PR pipeline

claude-codeautomationgithub-actionsci-cdpull-requests
13 views

Problem

The typical development loop is: read issue, understand context, write code, open PR, wait for review. For well-defined tasks, this manual loop adds hours of latency. You want to create a GitHub issue, have an AI agent write the code on a branch, open a PR, and then you just review and merge. This is especially valuable for bug fixes, small features, and repetitive changes.

Solution

Step 1: Install the Claude Code GitHub Action

Use grll/claude-code-action which supports OAuth authentication with your Claude Max plan:

# .github/workflows/claude-code.yml
name: Claude Code Agent
on:
  issues:
    types: [labeled]

jobs:
  claude-code:
    if: contains(github.event.label.name, 'claude')
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run Claude Code
        uses: grll/claude-code-action@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          issue_number: ${{ github.event.issue.number }}
          model: "claude-sonnet-4-5-20250929"

Step 2: Configure the repository

Add your Anthropic API key as a repository secret:

# Set via GitHub CLI
gh secret set ANTHROPIC_API_KEY --body "sk-ant-..."

Add a CLAUDE.md file to your repo root with project-specific instructions:

# Project Context
- This is a Next.js app with TypeScript
- Use the existing patterns in src/components for new UI
- Run `npm test` before committing
- Follow the existing code style (no semicolons, single quotes)

Step 3: Create an issue and trigger the agent

Title: Fix pagination on user list page
Label: claude

Body:
The user list at /dashboard/users shows all users on one page.
Add pagination with 25 users per page using the existing
Pagination component from src/components/ui/Pagination.tsx.

Step 4: Review and merge

The agent creates a branch, implements the change, runs tests, and opens a PR. You review the diff, test in preview deployment, and merge:

Workflow:
1. Create issue with 'claude' label
2. Action triggers Claude Code agent
3. Agent reads issue + codebase + CLAUDE.md
4. Agent creates branch and implements changes
5. Agent opens PR linked to the issue
6. You review the PR diff
7. Test in preview deployment (Vercel/Netlify)
8. Merge when satisfied

Why It Works

The GitHub Action gives Claude Code full access to the repository context through checkout, the issue description as the task prompt, and the ability to create branches and PRs through the GitHub API. The CLAUDE.md file provides project-specific instructions that ground the agent in your codebase conventions. By running on GitHub Actions infrastructure, the agent has a clean environment for each task, avoiding context pollution between tasks. The PR workflow preserves human review as the quality gate.

Context

  • The grll/claude-code-action is a community fork that supports OAuth with Claude Max plans
  • Works with Claude Max ($100-$200/month) subscriptions, not just API keys
  • Add the claude label to any issue to trigger the agent; remove the label to prevent re-triggering
  • Combine with branch-based preview deployments (Vercel, Netlify) for visual verification before merge
  • The agent reads your CLAUDE.md for project conventions, so keep it updated
  • For larger tasks, break the issue into smaller sub-issues that the agent can handle independently
  • Claude Code also supports being tagged directly in PR comments for code review
About this share
Contributormblode
Repositorymblode/shares
CreatedFeb 10, 2026
View on GitHub