diff --git a/action.yml b/action.yml index 6418040a8..dcbdb0dcd 100644 --- a/action.yml +++ b/action.yml @@ -64,6 +64,9 @@ inputs: github_token: description: "GitHub token with repo and pull request permissions (optional if using GitHub App)" required: false + github_dotcom_token: + description: "GitHub.com token for downloading dependencies (setup-bun). Required for GHES deployments to avoid rate limits. For GitHub.com deployments, falls back to the workflow's default token" + required: false use_bedrock: description: "Use Amazon Bedrock with OIDC authentication instead of direct Anthropic API" required: false @@ -159,7 +162,7 @@ runs: uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # https://github.com/oven-sh/setup-bun/releases/tag/v2.1.2 with: bun-version: 1.3.6 - token: ${{ inputs.github_token || github.token }} + token: ${{ inputs.github_dotcom_token || github.token }} - name: Setup Custom Bun Path if: inputs.path_to_bun_executable != '' diff --git a/base-action/action.yml b/base-action/action.yml index 10ce8388d..dc0d0816b 100644 --- a/base-action/action.yml +++ b/base-action/action.yml @@ -46,6 +46,10 @@ inputs: description: "Use Microsoft Foundry with OIDC authentication instead of direct Anthropic API" required: false default: "false" + github_dotcom_token: + description: "GitHub.com token for downloading dependencies (setup-bun). Required for GHES deployments to avoid rate limits. For GitHub.com deployments, falls back to the workflow's default token" + required: false + default: "" use_node_cache: description: "Whether to use Node.js dependency caching (set to true only for Node.js projects with lock files)" @@ -100,6 +104,7 @@ runs: uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # https://github.com/oven-sh/setup-bun/releases/tag/v2.1.2 with: bun-version: 1.3.6 + token: ${{ inputs.github_dotcom_token || github.token }} - name: Setup Custom Bun Path if: inputs.path_to_bun_executable != '' diff --git a/docs/setup.md b/docs/setup.md index e0c7f56c8..f2f9b6053 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -131,6 +131,24 @@ If you prefer to configure the app manually or need custom permissions: For more information on creating GitHub Apps, see the [GitHub documentation](https://docs.github.com/en/apps/creating-github-apps). +### GitHub Enterprise Server (GHES) Setup + +When running this action on GitHub Enterprise Server, you should provide a GitHub.com token separately to avoid rate limits when downloading dependencies: + +1. Create a GitHub.com personal access token (classic) with no scopes (public access only) +2. Add it as a repository secret (e.g., `GITHUB_DOTCOM_TOKEN`) +3. Pass it to the action: + + ```yaml + - uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + github_token: ${{ steps.app-token.outputs.token }} # GHES token + github_dotcom_token: ${{ secrets.GITHUB_DOTCOM_TOKEN }} # GitHub.com token + ``` + +**GitHub.com deployments:** You don't need to set `github_dotcom_token`, it automatically falls back to the workflow's default token. + ## Security Best Practices **⚠️ IMPORTANT: Never commit API keys directly to your repository! Always use GitHub Actions secrets.** diff --git a/docs/usage.md b/docs/usage.md index 3e55a3d58..77e830132 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -63,6 +63,7 @@ jobs: | `base_branch` | The base branch to use for creating new branches (e.g., 'main', 'develop') | No | - | | `use_sticky_comment` | Use just one comment to deliver PR comments (only applies for pull_request event workflows) | No | `false` | | `github_token` | GitHub token for Claude to operate with. **Only include this if you're connecting a custom GitHub app of your own!** | No | - | +| `github_dotcom_token` | GitHub.com token for downloading dependencies. Required for GHES deployments to avoid rate limits. Falls back to workflow token for GitHub.com | No | - | | `use_bedrock` | Use Amazon Bedrock with OIDC authentication instead of direct Anthropic API | No | `false` | | `use_vertex` | Use Google Vertex AI with OIDC authentication instead of direct Anthropic API | No | `false` | | `assignee_trigger` | The assignee username that triggers the action (e.g. @claude). Only used for issue assignment | No | - |