DaleSchool

Full GitHub Automation

Advanced20min

Learning Objectives

  • Automatically resolve GitHub issues with Claude Code
  • Know how to delegate PR reviews to Claude
  • Understand patterns for using Claude Code in GitHub Actions

Working Code

Let's resolve a GitHub issue with Claude Code:

> Show me the open issues with gh issue list

Pick an issue:

> Resolve issue #42. Read the issue, create a branch, fix the code, and create a PR.

Claude proceeds step by step:

  1. gh issue view 42 to read the issue
  2. git checkout -b fix/issue-42 to create a branch
  3. Code changes
  4. Commit
  5. gh pr create to create a PR

The entire process is handled in a single request.

Try It Yourself

Automate PR reviews:

> Show me the open PRs with gh pr list
> Review the changes in PR #15.
> Analyze from the perspectives of code quality, security, performance, and test coverage.

Claude analyzes the PR diff and provides a detailed review. To leave the review as a PR comment:

> Post this review as a PR comment

"Why?" — AI Integration in the Development Pipeline

GitHub is the center of most development team workflows. Connecting Claude Code to GitHub accelerates the entire cycle from issue to code to PR to review.

Claude Code + GitHub Workflow

Issue filed → Claude analyzes issue → Branch created → Code fixed → Tests → PR created → Review

Common GitHub Automation Patterns

| Pattern | Prompt | | ---------------- | ------------------------------------------- | | Issue resolution | "Resolve issue #N" | | PR creation | "Create a PR with the current changes" | | PR review | "Review the code in PR #N" | | Release notes | "Summarize changes since the last release" | | Issue triage | "Categorize and prioritize the open issues" |

Using Claude Code in GitHub Actions

Running Claude Code in GitHub Actions integrates AI into your CI/CD pipeline:

# .github/workflows/claude-review.yml
name: Claude Code Review
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run Claude Code Review
        run: |
          npm install -g @anthropic-ai/claude-code
          claude --print "Review the changes in this PR"
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

The --print flag runs Claude Code in non-interactive mode, outputting only the result.

Deep Dive

What if Claude misunderstands the issue?

Claude can misinterpret issues. To prevent this:

  1. Write clear issues — include reproduction steps, expected behavior, and actual behavior.
  2. Work step by step — instead of "resolve the issue," try "summarize the issue" first, confirm, then "fix it in this direction."
  3. Review the PR — always have a human review auto-generated PRs.
  1. Create a test issue and ask Claude to resolve it.
  2. Ask Claude to review an open PR's code.
  3. Ask Claude to "analyze the last 10 commits and write release notes."

Q1. What flag do you use to run Claude Code non-interactively in CI/CD?

  • A) --auto
  • B) --ci
  • C) --print
  • D) --non-interactive

Further Reading