This commit is contained in:
github-actions[bot]
2025-09-04 11:44:18 -07:00
parent 59a49d170c
commit 5b1f984703
8 changed files with 40 additions and 49 deletions

View File

@@ -74,13 +74,13 @@ inputs:
required: false required: false
default: "false" default: "false"
bot_id: bot_id:
description: "GitHub user ID to use for git operations (defaults to github-actions[bot] ID)" description: "GitHub user ID to use for git operations (defaults to Claude's bot ID)"
required: false required: false
default: "41898282" # github-actions[bot] ID - see src/github/constants.ts default: "41898282" # Claude's bot ID - see src/github/constants.ts
bot_name: bot_name:
description: "GitHub username to use for git operations (defaults to github-actions[bot])" description: "GitHub username to use for git operations (defaults to Claude's bot name)"
required: false required: false
default: "github-actions[bot]" default: "claude[bot]"
track_progress: track_progress:
description: "Force tag mode with tracking comments for pull_request and issue events. Only applicable to pull_request (opened, synchronize, ready_for_review, reopened) and issue (opened, edited, labeled, assigned) events." description: "Force tag mode with tracking comments for pull_request and issue events. Only applicable to pull_request (opened, synchronize, ready_for_review, reopened) and issue (opened, edited, labeled, assigned) events."
required: false required: false

View File

@@ -32,9 +32,9 @@ The OIDC token is required in order for the Claude GitHub app to function. If yo
This error occurs when the action tries to fetch the authenticated user information using a GitHub App installation token. GitHub App tokens have limited access and cannot access the `/user` endpoint, which causes this 403 error. This error occurs when the action tries to fetch the authenticated user information using a GitHub App installation token. GitHub App tokens have limited access and cannot access the `/user` endpoint, which causes this 403 error.
**Solution**: The action now includes `bot_id` and `bot_name` inputs that default to github-actions[bot]. This avoids the need to fetch user information from the API. **Solution**: The action now includes `bot_id` and `bot_name` inputs that default to Claude's bot credentials. This avoids the need to fetch user information from the API.
For the default github-actions[bot]: For the default claude[bot]:
```yaml ```yaml
- uses: anthropics/claude-code-action@v1 - uses: anthropics/claude-code-action@v1

View File

@@ -48,7 +48,7 @@ jobs:
## Inputs ## Inputs
| Input | Description | Required | Default | | Input | Description | Required | Default |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------- | -------- | --------------------- | | ------------------------------ | -------------------------------------------------------------------------------------------------------------------- | -------- | ------------- |
| `anthropic_api_key` | Anthropic API key (required for direct API, not needed for Bedrock/Vertex) | No\* | - | | `anthropic_api_key` | Anthropic API key (required for direct API, not needed for Bedrock/Vertex) | No\* | - |
| `claude_code_oauth_token` | Claude Code OAuth token (alternative to anthropic_api_key) | No\* | - | | `claude_code_oauth_token` | Claude Code OAuth token (alternative to anthropic_api_key) | No\* | - |
| `prompt` | Instructions for Claude. Can be a direct prompt or custom template for automation workflows | No | - | | `prompt` | Instructions for Claude. Can be a direct prompt or custom template for automation workflows | No | - |
@@ -68,8 +68,8 @@ jobs:
| `additional_permissions` | Additional permissions to enable. Currently supports 'actions: read' for viewing workflow results | No | "" | | `additional_permissions` | Additional permissions to enable. Currently supports 'actions: read' for viewing workflow results | No | "" |
| `experimental_allowed_domains` | Restrict network access to these domains only (newline-separated). | No | "" | | `experimental_allowed_domains` | Restrict network access to these domains only (newline-separated). | No | "" |
| `use_commit_signing` | Enable commit signing using GitHub's commit signature verification. When false, Claude uses standard git commands | No | `false` | | `use_commit_signing` | Enable commit signing using GitHub's commit signature verification. When false, Claude uses standard git commands | No | `false` |
| `bot_id` | GitHub user ID to use for git operations (defaults to github-actions[bot] ID) | No | `41898282` | | `bot_id` | GitHub user ID to use for git operations (defaults to Claude's bot ID) | No | `41898282` |
| `bot_name` | GitHub username to use for git operations (defaults to github-actions[bot]) | No | `github-actions[bot]` | | `bot_name` | GitHub username to use for git operations (defaults to Claude's bot name) | No | `claude[bot]` |
| `allowed_bots` | Comma-separated list of allowed bot usernames, or '\*' to allow all bots. Empty string (default) allows no bots | No | "" | | `allowed_bots` | Comma-separated list of allowed bot usernames, or '\*' to allow all bots. Empty string (default) allows no bots | No | "" |
### Deprecated Inputs ### Deprecated Inputs

View File

@@ -8,6 +8,6 @@
export const CLAUDE_APP_BOT_ID = 41898282; export const CLAUDE_APP_BOT_ID = 41898282;
/** /**
* GitHub Actions bot username * Claude bot username
*/ */
export const GITHUB_ACTIONS_BOT_LOGIN = "github-actions[bot]"; export const CLAUDE_BOT_LOGIN = "claude[bot]";

View File

@@ -8,7 +8,7 @@ import type {
PullRequestReviewCommentEvent, PullRequestReviewCommentEvent,
WorkflowRunEvent, WorkflowRunEvent,
} from "@octokit/webhooks-types"; } from "@octokit/webhooks-types";
import { CLAUDE_APP_BOT_ID, GITHUB_ACTIONS_BOT_LOGIN } from "./constants"; import { CLAUDE_APP_BOT_ID, CLAUDE_BOT_LOGIN } from "./constants";
// Custom types for GitHub Actions events that aren't webhooks // Custom types for GitHub Actions events that aren't webhooks
export type WorkflowDispatchEvent = { export type WorkflowDispatchEvent = {
action?: never; action?: never;
@@ -126,7 +126,7 @@ export function parseGitHubContext(): GitHubContext {
useStickyComment: process.env.USE_STICKY_COMMENT === "true", useStickyComment: process.env.USE_STICKY_COMMENT === "true",
useCommitSigning: process.env.USE_COMMIT_SIGNING === "true", useCommitSigning: process.env.USE_COMMIT_SIGNING === "true",
botId: process.env.BOT_ID ?? String(CLAUDE_APP_BOT_ID), botId: process.env.BOT_ID ?? String(CLAUDE_APP_BOT_ID),
botName: process.env.BOT_NAME ?? GITHUB_ACTIONS_BOT_LOGIN, botName: process.env.BOT_NAME ?? CLAUDE_BOT_LOGIN,
allowedBots: process.env.ALLOWED_BOTS ?? "", allowedBots: process.env.ALLOWED_BOTS ?? "",
trackProgress: process.env.TRACK_PROGRESS === "true", trackProgress: process.env.TRACK_PROGRESS === "true",
}, },

View File

@@ -2,10 +2,7 @@ import { describe, test, expect, beforeEach, afterEach, spyOn } from "bun:test";
import { prepareMcpConfig } from "../src/mcp/install-mcp-server"; import { prepareMcpConfig } from "../src/mcp/install-mcp-server";
import * as core from "@actions/core"; import * as core from "@actions/core";
import type { ParsedGitHubContext } from "../src/github/context"; import type { ParsedGitHubContext } from "../src/github/context";
import { import { CLAUDE_APP_BOT_ID, CLAUDE_BOT_LOGIN } from "../src/github/constants";
CLAUDE_APP_BOT_ID,
GITHUB_ACTIONS_BOT_LOGIN,
} from "../src/github/constants";
describe("prepareMcpConfig", () => { describe("prepareMcpConfig", () => {
let consoleInfoSpy: any; let consoleInfoSpy: any;
@@ -36,7 +33,7 @@ describe("prepareMcpConfig", () => {
useStickyComment: false, useStickyComment: false,
useCommitSigning: false, useCommitSigning: false,
botId: String(CLAUDE_APP_BOT_ID), botId: String(CLAUDE_APP_BOT_ID),
botName: GITHUB_ACTIONS_BOT_LOGIN, botName: CLAUDE_BOT_LOGIN,
allowedBots: "", allowedBots: "",
trackProgress: false, trackProgress: false,
}, },

View File

@@ -9,10 +9,7 @@ import type {
PullRequestReviewEvent, PullRequestReviewEvent,
PullRequestReviewCommentEvent, PullRequestReviewCommentEvent,
} from "@octokit/webhooks-types"; } from "@octokit/webhooks-types";
import { import { CLAUDE_APP_BOT_ID, CLAUDE_BOT_LOGIN } from "../src/github/constants";
CLAUDE_APP_BOT_ID,
GITHUB_ACTIONS_BOT_LOGIN,
} from "../src/github/constants";
const defaultInputs = { const defaultInputs = {
prompt: "", prompt: "",
@@ -23,7 +20,7 @@ const defaultInputs = {
useStickyComment: false, useStickyComment: false,
useCommitSigning: false, useCommitSigning: false,
botId: String(CLAUDE_APP_BOT_ID), botId: String(CLAUDE_APP_BOT_ID),
botName: GITHUB_ACTIONS_BOT_LOGIN, botName: CLAUDE_BOT_LOGIN,
allowedBots: "", allowedBots: "",
trackProgress: false, trackProgress: false,
}; };

View File

@@ -2,10 +2,7 @@ import { describe, expect, test, spyOn, beforeEach, afterEach } from "bun:test";
import * as core from "@actions/core"; import * as core from "@actions/core";
import { checkWritePermissions } from "../src/github/validation/permissions"; import { checkWritePermissions } from "../src/github/validation/permissions";
import type { ParsedGitHubContext } from "../src/github/context"; import type { ParsedGitHubContext } from "../src/github/context";
import { import { CLAUDE_APP_BOT_ID, CLAUDE_BOT_LOGIN } from "../src/github/constants";
CLAUDE_APP_BOT_ID,
GITHUB_ACTIONS_BOT_LOGIN,
} from "../src/github/constants";
describe("checkWritePermissions", () => { describe("checkWritePermissions", () => {
let coreInfoSpy: any; let coreInfoSpy: any;
@@ -72,7 +69,7 @@ describe("checkWritePermissions", () => {
useStickyComment: false, useStickyComment: false,
useCommitSigning: false, useCommitSigning: false,
botId: String(CLAUDE_APP_BOT_ID), botId: String(CLAUDE_APP_BOT_ID),
botName: GITHUB_ACTIONS_BOT_LOGIN, botName: CLAUDE_BOT_LOGIN,
allowedBots: "", allowedBots: "",
trackProgress: false, trackProgress: false,
}, },