Skip to content

Instantly share code, notes, and snippets.

@sgbaird
Last active July 16, 2026 15:57
Show Gist options
  • Select an option

  • Save sgbaird/241ba51d7f87bee26056b14a0d66d8e7 to your computer and use it in GitHub Desktop.

Select an option

Save sgbaird/241ba51d7f87bee26056b14a0d66d8e7 to your computer and use it in GitHub Desktop.
Claude Code GitHub Actions - to be put in .github/workflows, based on instructions in https://code.claude.com/docs/en/github-actions, modified for myself
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
# Allow long waits (e.g., Edison polling) without hitting a job-level limit
timeout-minutes: 180
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EDISON_PLATFORM_API_KEY: ${{ secrets.EDISON_PLATFORM_API_KEY }}
# Allow long-blocking foreground commands (e.g., Edison polling)
BASH_DEFAULT_TIMEOUT_MS: "900000" # 15 min default per Bash call
BASH_MAX_TIMEOUT_MS: "3600000" # 60 min ceiling per Bash call
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# # Optional (riskier): Print the full turn-by-turn JSON execution log in the step output
# show_full_output: true
# # Optional (riskier): Render a human-readable "Claude Code Report" in the job's Step Summary
# display_report: true
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'
# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
# claude_args: '--allowed-tools Bash(gh pr *)'
claude_args: |
--model claude-fable-5
--permission-mode bypassPermissions
# # Optional, recommended if you set show_full_output=True
# - name: Upload Claude execution log
# if: always() && steps.claude.outputs.execution_file != ''
# uses: actions/upload-artifact@v4
# with:
# name: claude-execution-log
# path: ${{ steps.claude.outputs.execution_file }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment