---
title: Claude Code GitHub Actions | RunAPI
description: Configure Claude Code GitHub Actions with a RunAPI secret, model, permissions,
  triggers, and a minimal workflow.
url: https://runapi.ai/docs/resources/tool-integrations/claude-code-github-actions.md
canonical: https://runapi.ai/docs/resources/tool-integrations/claude-code-github-actions
locale: en
---

> HTML version: https://runapi.ai/docs/resources/tool-integrations/claude-code-github-actions
> Site index for agents: https://runapi.ai/llms.txt

# Claude Code GitHub Actions

## 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](https://runapi.ai/docs/guides/authentication.md).
* Copy a model identifier that supports Anthropic Messages from the
  [Model Catalog](https://runapi.ai/models).
* Review the [Claude Code GitHub Actions setup][1] and your
  organization's workflow policy.



[1]: https://code.claude.com/docs/en/github-actions

## 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][1], then add the
workflow below to `.github/workflows/claude.yml`.



[1]: https://github.com/apps/claude

## Configure RunAPI

Create a repository or organization Actions secret named
`RUNAPI_API_KEY`. Pass it only through the action's secret input:

```yaml
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:

```yaml
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][1] for repository and organization
scope.



[1]: https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets

### Permissions

* `contents: write` lets the action commit code changes.
* `pull-requests: write` and `issues: write` let it read and reply to
  the triggering conversation.
* `id-token: write` supports the action's default GitHub App
  authentication.
* `actions: read` lets 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][1] as the canonical reference.



[1]: https://code.claude.com/docs/en/github-actions#who-can-trigger-runs

## Choose a model

Replace `YOUR_RUNAPI_MODEL_ID` in `claude_args` with the exact
identifier from the [Model Catalog](https://runapi.ai/models). Keeping model selection
outside `settings.env` makes the workflow's chosen model visible in the
action configuration.

## Verify

1.  Confirm the `RUNAPI_API_KEY` secret exists without printing its
    value.
2.  Merge the workflow into the default branch and confirm Actions are
    enabled.
3.  From an account with repository write access, add `@claude describe
    this repository in one sentence` to an issue comment.
4.  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 `@claude` and 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](https://runapi.ai/docs/guides/authentication.md) 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](https://runapi.ai/models).
* **Claude commits do not start another workflow:** review the official
  action's [GitHub token troubleshooting][1].



[1]: https://code.claude.com/docs/en/github-actions#ci-not-running-on-claudes-commits

## Next steps

Use the [LLM API quickstart](https://runapi.ai/docs/guides/llm-api/quickstart.md) for
protocol behavior and the [Anthropic Messages API
Reference](https://runapi.ai/docs/api/anthropic/messages.md) for request fields. For more
triggers and action inputs, use the [official examples][1] and
[configuration reference][2].



[1]: https://github.com/anthropics/claude-code-action/tree/main/examples
[2]: https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md

---

## More from RunAPI

- [Home](https://runapi.ai/.md)
- [Models](https://runapi.ai/models.md)
- [AI Video API Comparison](https://runapi.ai/ai-video-api-comparison.md)
- [OpenClaw Integration](https://runapi.ai/openclaw.md)
- [Best API for OpenClaw](https://runapi.ai/best-api-for-openclaw.md)
- [OpenClaw Image Generation](https://runapi.ai/openclaw-image-generation.md)
- [Hermes Agent Integration](https://runapi.ai/hermes-agent.md)
- [Pricing](https://runapi.ai/pricing.md)
- [Claude API Pricing](https://runapi.ai/claude-api-pricing.md)
- [ChatGPT API Pricing](https://runapi.ai/chatgpt-api-pricing.md)
- [OpenAI API Pricing](https://runapi.ai/openai-api-pricing.md)
- [Gemini API Pricing](https://runapi.ai/gemini-api-pricing.md)
- [Claude Code Pricing](https://runapi.ai/claude-code-pricing.md)
- [Claude Code API](https://runapi.ai/claude-code-api.md)
- [Claude Code vs Cursor](https://runapi.ai/claude-code-vs-cursor.md)
- [Claude Max vs API](https://runapi.ai/claude-max-vs-api.md)
- [Requesty Alternative](https://runapi.ai/requesty-alternative.md)
- [Docs](https://runapi.ai/docs/guides)
- [SDK](https://runapi.ai/sdk.md)
- [Skills](https://runapi.ai/skills.md)
- [MCP Server](https://runapi.ai/mcp.md)
- [CLI](https://runapi.ai/cli.md)
- [Feedback](https://runapi.ai/)
- [Contact](mailto:support@runapi.ai)
- [Terms](https://runapi.ai/terms.md)
- [Privacy](https://runapi.ai/privacy.md)
- [Site index for agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Structured data

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "en",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "en",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/icon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "en",
    "@type": "TechArticle",
    "headline": "Claude Code GitHub Actions",
    "description": "Configure Claude Code GitHub Actions with a RunAPI secret, model, permissions, triggers, and a minimal workflow.",
    "url": "https://runapi.ai/docs/resources/tool-integrations/claude-code-github-actions",
    "mainEntityOfPage": "https://runapi.ai/docs/resources/tool-integrations/claude-code-github-actions"
  }
]
```
