Claude Code GitHub Actions
Configure Claude Code GitHub Actions with a RunAPI secret, model, permissions, triggers, and a minimal workflow.
Overview
The official anthropics/claude-code-action runs Claude Code in a GitHub Actions workflow. This guide stores a RunAPI key as a GitHub Secret, sets the non-sensitive Base URL in Claude Code settings, selects a model, and responds to authorized @claude comments.
Before you begin
- You need repository administrator access to install the Claude GitHub App, create Actions secrets, and add a workflow.
- Create a standard RunAPI API key in the Authentication Guide.
- Copy a model identifier that supports Anthropic Messages from the Model Catalog.
- Review the Claude Code GitHub Actions setup and your organization’s workflow policy.
Install
From Claude Code in the target repository, run /install-github-app and follow the prompts to install the GitHub App. When it offers to create an Anthropic credential, stop before saving one: this guide uses a RunAPI repository or organization secret instead.
For manual setup, install the Claude GitHub App, then add the workflow below to .github/workflows/claude.yml.
Configure RunAPI
Create a repository or organization Actions secret named RUNAPI_API_KEY. Pass it only through the action’s secret input:
anthropic_api_key: ${{ secrets.RUNAPI_API_KEY }}
Do not put the key in the workflow file or the action’s settings JSON. The action processes settings separately; only the non-sensitive Base URL belongs there.
The following minimal interactive workflow listens for new issue and pull request review comments:
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
claude:
if: contains(github.event.comment.body, '@claude')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.RUNAPI_API_KEY }}
settings: |
{
"env": {
"ANTHROPIC_BASE_URL": "https://runapi.ai"
}
}
claude_args: "--model YOUR_RUNAPI_MODEL_ID"
Secrets
GitHub does not pass ordinary Actions secrets to workflows triggered from fork pull requests or Dependabot events. If a run has no credential, confirm the event source before rotating the RunAPI key. Use GitHub’s Actions secrets guide for repository and organization scope.
Permissions
contents: writelets the action commit code changes.pull-requests: writeandissues: writelet it read and reply to the triggering conversation.id-token: writesupports the action’s default GitHub App authentication.actions: readlets it inspect workflow results.
Use these explicit permissions instead of write-all. Remove capabilities your workflow does not need.
Trigger events
issue_comment covers comments in issues and pull request conversations; pull_request_review_comment covers comments on diff lines. The workflow file must exist on the default branch before issue_comment can trigger it. The action also checks who initiated the run; use the official security behavior as the canonical reference.
Choose a model
Replace YOUR_RUNAPI_MODEL_ID in claude_args with the exact identifier from the Model Catalog. Keeping model selection outside settings.env makes the workflow’s chosen model visible in the action configuration.
Verify
- Confirm the
RUNAPI_API_KEYsecret exists without printing its value. - Merge the workflow into the default branch and confirm Actions are enabled.
- From an account with repository write access, add
@claude describe this repository in one sentenceto an issue comment. - Open the workflow run, confirm the action succeeds, and verify that Claude replies in the same issue.
Troubleshoot
- No workflow starts: confirm the file is on the default branch, the comment event matches, and Actions are enabled.
- The job is skipped: confirm the comment contains
@claudeand the actor has the required repository access. - Authentication fails: confirm the workflow references
secrets.RUNAPI_API_KEY, then rotate the key through the Authentication Guide if needed. - A fork pull request cannot use the key: GitHub intentionally withholds ordinary secrets from fork-triggered runs. Do not replace the secret with a literal.
- The model is unavailable: copy the exact identifier from the Model Catalog.
- Claude commits do not start another workflow: review the official action’s GitHub token troubleshooting.
Next steps
Use the LLM API quickstart for protocol behavior and the Anthropic Messages API Reference for request fields. For more triggers and action inputs, use the official examples and configuration reference.