From 5b1f984703cf171066c6237047661fb2626174f3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 11:44:18 -0700 Subject: [PATCH] tmp --- action.yml | 8 +++--- docs/faq.md | 4 +-- docs/usage.md | 48 ++++++++++++++++----------------- src/github/constants.ts | 4 +-- src/github/context.ts | 4 +-- test/install-mcp-server.test.ts | 7 ++--- test/mockContext.ts | 7 ++--- test/permissions.test.ts | 7 ++--- 8 files changed, 40 insertions(+), 49 deletions(-) diff --git a/action.yml b/action.yml index a6882ff..943a253 100644 --- a/action.yml +++ b/action.yml @@ -74,13 +74,13 @@ inputs: required: false default: "false" 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 - default: "41898282" # github-actions[bot] ID - see src/github/constants.ts + default: "41898282" # Claude's bot ID - see src/github/constants.ts 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 - default: "github-actions[bot]" + default: "claude[bot]" 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." required: false diff --git a/docs/faq.md b/docs/faq.md index a50e2fc..269728e 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -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. -**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 - uses: anthropics/claude-code-action@v1 diff --git a/docs/usage.md b/docs/usage.md index c284ddc..58cc1fa 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -47,30 +47,30 @@ jobs: ## Inputs -| Input | Description | Required | Default | -| ------------------------------ | -------------------------------------------------------------------------------------------------------------------- | -------- | --------------------- | -| `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\* | - | -| `prompt` | Instructions for Claude. Can be a direct prompt or custom template for automation workflows | No | - | -| `track_progress` | Force tag mode with tracking comments. Only works with specific PR/issue events. Preserves GitHub context | No | `false` | -| `claude_args` | Additional arguments to pass directly to Claude CLI (e.g., `--max-turns 10 --model claude-4-0-sonnet-20250805`) | No | "" | -| `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 | - | -| `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` | -| `mcp_config` | Additional MCP configuration (JSON string) that merges with the built-in GitHub MCP servers | No | "" | -| `assignee_trigger` | The assignee username that triggers the action (e.g. @claude). Only used for issue assignment | No | - | -| `label_trigger` | The label name that triggers the action when applied to an issue (e.g. "claude") | No | - | -| `trigger_phrase` | The trigger phrase to look for in comments, issue/PR bodies, and issue titles | No | `@claude` | -| `branch_prefix` | The prefix to use for Claude branches (defaults to 'claude/', use 'claude-' for dash format) | No | `claude/` | -| `settings` | Claude Code settings as JSON string or path to settings JSON file | 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 | "" | -| `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_name` | GitHub username to use for git operations (defaults to github-actions[bot]) | No | `github-actions[bot]` | -| `allowed_bots` | Comma-separated list of allowed bot usernames, or '\*' to allow all bots. Empty string (default) allows no bots | No | "" | +| Input | Description | Required | Default | +| ------------------------------ | -------------------------------------------------------------------------------------------------------------------- | -------- | ------------- | +| `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\* | - | +| `prompt` | Instructions for Claude. Can be a direct prompt or custom template for automation workflows | No | - | +| `track_progress` | Force tag mode with tracking comments. Only works with specific PR/issue events. Preserves GitHub context | No | `false` | +| `claude_args` | Additional arguments to pass directly to Claude CLI (e.g., `--max-turns 10 --model claude-4-0-sonnet-20250805`) | No | "" | +| `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 | - | +| `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` | +| `mcp_config` | Additional MCP configuration (JSON string) that merges with the built-in GitHub MCP servers | No | "" | +| `assignee_trigger` | The assignee username that triggers the action (e.g. @claude). Only used for issue assignment | No | - | +| `label_trigger` | The label name that triggers the action when applied to an issue (e.g. "claude") | No | - | +| `trigger_phrase` | The trigger phrase to look for in comments, issue/PR bodies, and issue titles | No | `@claude` | +| `branch_prefix` | The prefix to use for Claude branches (defaults to 'claude/', use 'claude-' for dash format) | No | `claude/` | +| `settings` | Claude Code settings as JSON string or path to settings JSON file | 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 | "" | +| `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 Claude's bot ID) | No | `41898282` | +| `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 | "" | ### Deprecated Inputs diff --git a/src/github/constants.ts b/src/github/constants.ts index ff5d8de..32818ff 100644 --- a/src/github/constants.ts +++ b/src/github/constants.ts @@ -8,6 +8,6 @@ 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]"; diff --git a/src/github/context.ts b/src/github/context.ts index 59ab993..94ef4f8 100644 --- a/src/github/context.ts +++ b/src/github/context.ts @@ -8,7 +8,7 @@ import type { PullRequestReviewCommentEvent, WorkflowRunEvent, } 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 export type WorkflowDispatchEvent = { action?: never; @@ -126,7 +126,7 @@ export function parseGitHubContext(): GitHubContext { useStickyComment: process.env.USE_STICKY_COMMENT === "true", useCommitSigning: process.env.USE_COMMIT_SIGNING === "true", 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 ?? "", trackProgress: process.env.TRACK_PROGRESS === "true", }, diff --git a/test/install-mcp-server.test.ts b/test/install-mcp-server.test.ts index 1f8dbfc..48b54be 100644 --- a/test/install-mcp-server.test.ts +++ b/test/install-mcp-server.test.ts @@ -2,10 +2,7 @@ import { describe, test, expect, beforeEach, afterEach, spyOn } from "bun:test"; import { prepareMcpConfig } from "../src/mcp/install-mcp-server"; import * as core from "@actions/core"; import type { ParsedGitHubContext } from "../src/github/context"; -import { - CLAUDE_APP_BOT_ID, - GITHUB_ACTIONS_BOT_LOGIN, -} from "../src/github/constants"; +import { CLAUDE_APP_BOT_ID, CLAUDE_BOT_LOGIN } from "../src/github/constants"; describe("prepareMcpConfig", () => { let consoleInfoSpy: any; @@ -36,7 +33,7 @@ describe("prepareMcpConfig", () => { useStickyComment: false, useCommitSigning: false, botId: String(CLAUDE_APP_BOT_ID), - botName: GITHUB_ACTIONS_BOT_LOGIN, + botName: CLAUDE_BOT_LOGIN, allowedBots: "", trackProgress: false, }, diff --git a/test/mockContext.ts b/test/mockContext.ts index d4f0698..57716da 100644 --- a/test/mockContext.ts +++ b/test/mockContext.ts @@ -9,10 +9,7 @@ import type { PullRequestReviewEvent, PullRequestReviewCommentEvent, } from "@octokit/webhooks-types"; -import { - CLAUDE_APP_BOT_ID, - GITHUB_ACTIONS_BOT_LOGIN, -} from "../src/github/constants"; +import { CLAUDE_APP_BOT_ID, CLAUDE_BOT_LOGIN } from "../src/github/constants"; const defaultInputs = { prompt: "", @@ -23,7 +20,7 @@ const defaultInputs = { useStickyComment: false, useCommitSigning: false, botId: String(CLAUDE_APP_BOT_ID), - botName: GITHUB_ACTIONS_BOT_LOGIN, + botName: CLAUDE_BOT_LOGIN, allowedBots: "", trackProgress: false, }; diff --git a/test/permissions.test.ts b/test/permissions.test.ts index 1a2fae1..6659d62 100644 --- a/test/permissions.test.ts +++ b/test/permissions.test.ts @@ -2,10 +2,7 @@ import { describe, expect, test, spyOn, beforeEach, afterEach } from "bun:test"; import * as core from "@actions/core"; import { checkWritePermissions } from "../src/github/validation/permissions"; import type { ParsedGitHubContext } from "../src/github/context"; -import { - CLAUDE_APP_BOT_ID, - GITHUB_ACTIONS_BOT_LOGIN, -} from "../src/github/constants"; +import { CLAUDE_APP_BOT_ID, CLAUDE_BOT_LOGIN } from "../src/github/constants"; describe("checkWritePermissions", () => { let coreInfoSpy: any; @@ -72,7 +69,7 @@ describe("checkWritePermissions", () => { useStickyComment: false, useCommitSigning: false, botId: String(CLAUDE_APP_BOT_ID), - botName: GITHUB_ACTIONS_BOT_LOGIN, + botName: CLAUDE_BOT_LOGIN, allowedBots: "", trackProgress: false, },