chore: merge 7 upstream commits from anthropics/claude-code-action
Conflicts resolved: - docs/usage.md: kept fork's `platform` row, added upstream's new `classify_inline_comments` row, updated `allowed_bots` description with upstream's security warning - src/create-prompt/index.ts: kept fork's DISALLOWED_TOOLS export (consumed by run.ts) vs upstream's dead-code comment - src/modes/tag/index.ts: merged both fork's userAllowedTools and upstream's gitPushWrapper variable (both needed by shared code) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
ec394266fc
25 files changed
+449
-85
No files matched your search
+23
-18
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import { describe, test, expect } from "bun:test";
|
||||
import { describe, test, expect, beforeAll } from "bun:test";
|
||||
import {
|
||||
generatePrompt,
|
||||
getEventTypeAndContext,
|
||||
@@ -9,6 +9,10 @@ import {
|
||||
} from "../src/create-prompt";
|
||||
import type { PreparedContext } from "../src/create-prompt";
|
||||
|
||||
beforeAll(() => {
|
||||
process.env.GITHUB_ACTION_PATH = "/test/action/path";
|
||||
});
|
||||
|
||||
describe("generatePrompt", () => {
|
||||
const mockGitHubData = {
|
||||
contextData: {
|
||||
@@ -505,7 +509,7 @@ describe("generatePrompt", () => {
|
||||
const prompt = await generatePrompt(envVars, mockGitHubData, false, "tag");
|
||||
|
||||
// Should contain PR-specific instructions (git commands when not using signing)
|
||||
expect(prompt).toContain("git push");
|
||||
expect(prompt).toContain("scripts/git-push.sh origin");
|
||||
expect(prompt).toContain(
|
||||
"Always push to the existing branch when triggered on a PR",
|
||||
);
|
||||
@@ -643,7 +647,7 @@ describe("generatePrompt", () => {
|
||||
const prompt = await generatePrompt(envVars, mockGitHubData, false, "tag");
|
||||
|
||||
// Should contain open PR instructions (git commands when not using signing)
|
||||
expect(prompt).toContain("git push");
|
||||
expect(prompt).toContain("scripts/git-push.sh origin");
|
||||
expect(prompt).toContain(
|
||||
"Always push to the existing branch when triggered on a PR",
|
||||
);
|
||||
@@ -757,7 +761,7 @@ describe("generatePrompt", () => {
|
||||
expect(prompt).toContain("Use git commands via the Bash tool");
|
||||
expect(prompt).toContain("git add");
|
||||
expect(prompt).toContain("git commit");
|
||||
expect(prompt).toContain("git push");
|
||||
expect(prompt).toContain("scripts/git-push.sh origin");
|
||||
|
||||
// Should use the minimal comment tool
|
||||
expect(prompt).toContain("mcp__github_comment__update_claude_comment");
|
||||
@@ -886,17 +890,18 @@ describe("buildAllowedToolsString", () => {
|
||||
const result = buildAllowedToolsString();
|
||||
|
||||
// The base tools should be in the result
|
||||
expect(result).toContain("Edit");
|
||||
// Edit/MultiEdit/Write are NOT in allowedTools — acceptEdits permission mode handles them
|
||||
expect(result).not.toContain("Edit");
|
||||
expect(result).not.toContain("Write");
|
||||
expect(result).toContain("Glob");
|
||||
expect(result).toContain("Grep");
|
||||
expect(result).toContain("LS");
|
||||
expect(result).toContain("Read");
|
||||
expect(result).toContain("Write");
|
||||
|
||||
// Default is no commit signing, so should have specific Bash git commands
|
||||
expect(result).toContain("Bash(git add:*)");
|
||||
expect(result).toContain("Bash(git commit:*)");
|
||||
expect(result).toContain("Bash(git push:*)");
|
||||
expect(result).toContain("scripts/git-push.sh:*)");
|
||||
expect(result).toContain("mcp__github_comment__update_claude_comment");
|
||||
|
||||
// Should not have commit signing tools
|
||||
@@ -908,12 +913,12 @@ describe("buildAllowedToolsString", () => {
|
||||
const result = buildAllowedToolsString([], false, false);
|
||||
|
||||
// The base tools should be in the result
|
||||
expect(result).toContain("Edit");
|
||||
expect(result).not.toContain("Edit");
|
||||
expect(result).toContain("Glob");
|
||||
expect(result).toContain("Grep");
|
||||
expect(result).toContain("LS");
|
||||
expect(result).toContain("Read");
|
||||
expect(result).toContain("Write");
|
||||
expect(result).not.toContain("Write");
|
||||
|
||||
// Should have specific Bash git commands for non-signing mode
|
||||
expect(result).toContain("Bash(git add:*)");
|
||||
@@ -930,7 +935,7 @@ describe("buildAllowedToolsString", () => {
|
||||
const result = buildAllowedToolsString(customTools);
|
||||
|
||||
// Base tools should be present
|
||||
expect(result).toContain("Edit");
|
||||
expect(result).toContain("Read");
|
||||
expect(result).toContain("Glob");
|
||||
|
||||
// Custom tools should be appended
|
||||
@@ -950,7 +955,7 @@ describe("buildAllowedToolsString", () => {
|
||||
const result = buildAllowedToolsString([], true);
|
||||
|
||||
// Base tools should be present
|
||||
expect(result).toContain("Edit");
|
||||
expect(result).toContain("Read");
|
||||
expect(result).toContain("Glob");
|
||||
|
||||
// GitHub Actions tools should be included
|
||||
@@ -964,7 +969,7 @@ describe("buildAllowedToolsString", () => {
|
||||
const result = buildAllowedToolsString(customTools, true);
|
||||
|
||||
// Base tools should be present
|
||||
expect(result).toContain("Edit");
|
||||
expect(result).toContain("Read");
|
||||
|
||||
// Custom tools should be included
|
||||
expect(result).toContain("Tool1");
|
||||
@@ -980,12 +985,12 @@ describe("buildAllowedToolsString", () => {
|
||||
const result = buildAllowedToolsString([], false, true);
|
||||
|
||||
// Base tools should be present
|
||||
expect(result).toContain("Edit");
|
||||
expect(result).not.toContain("Edit");
|
||||
expect(result).toContain("Glob");
|
||||
expect(result).toContain("Grep");
|
||||
expect(result).toContain("LS");
|
||||
expect(result).toContain("Read");
|
||||
expect(result).toContain("Write");
|
||||
expect(result).not.toContain("Write");
|
||||
|
||||
// Commit signing tools should be included
|
||||
expect(result).toContain("mcp__github_file_ops__commit_files");
|
||||
@@ -1001,17 +1006,17 @@ describe("buildAllowedToolsString", () => {
|
||||
const result = buildAllowedToolsString([], false, false);
|
||||
|
||||
// Base tools should be present
|
||||
expect(result).toContain("Edit");
|
||||
expect(result).not.toContain("Edit");
|
||||
expect(result).toContain("Glob");
|
||||
expect(result).toContain("Grep");
|
||||
expect(result).toContain("LS");
|
||||
expect(result).toContain("Read");
|
||||
expect(result).toContain("Write");
|
||||
expect(result).not.toContain("Write");
|
||||
|
||||
// Specific Bash git commands should be included
|
||||
expect(result).toContain("Bash(git add:*)");
|
||||
expect(result).toContain("Bash(git commit:*)");
|
||||
expect(result).toContain("Bash(git push:*)");
|
||||
expect(result).toContain("scripts/git-push.sh:*)");
|
||||
expect(result).toContain("Bash(git status:*)");
|
||||
expect(result).toContain("Bash(git diff:*)");
|
||||
expect(result).toContain("Bash(git log:*)");
|
||||
@@ -1030,7 +1035,7 @@ describe("buildAllowedToolsString", () => {
|
||||
const result = buildAllowedToolsString(customTools, true, false);
|
||||
|
||||
// Base tools should be present
|
||||
expect(result).toContain("Edit");
|
||||
expect(result).toContain("Read");
|
||||
expect(result).toContain("Bash(git add:*)");
|
||||
|
||||
// Custom tools should be included
|
||||
|
||||
@@ -33,6 +33,7 @@ describe("prepareMcpConfig", () => {
|
||||
labelTrigger: "",
|
||||
branchPrefix: "",
|
||||
useStickyComment: false,
|
||||
classifyInlineComments: true,
|
||||
useCommitSigning: false,
|
||||
sshSigningKey: "",
|
||||
botId: String(CLAUDE_APP_BOT_ID),
|
||||
|
||||
@@ -19,6 +19,7 @@ const defaultInputs = {
|
||||
labelTrigger: "",
|
||||
branchPrefix: "claude/",
|
||||
useStickyComment: false,
|
||||
classifyInlineComments: true,
|
||||
useCommitSigning: false,
|
||||
sshSigningKey: "",
|
||||
botId: String(CLAUDE_APP_BOT_ID),
|
||||
|
||||
@@ -19,6 +19,7 @@ describe("detectMode with enhanced routing", () => {
|
||||
labelTrigger: "",
|
||||
branchPrefix: "claude/",
|
||||
useStickyComment: false,
|
||||
classifyInlineComments: true,
|
||||
useCommitSigning: false,
|
||||
sshSigningKey: "",
|
||||
botId: "123456",
|
||||
|
||||
@@ -68,6 +68,7 @@ describe("checkWritePermissions", () => {
|
||||
labelTrigger: "",
|
||||
branchPrefix: "claude/",
|
||||
useStickyComment: false,
|
||||
classifyInlineComments: true,
|
||||
useCommitSigning: false,
|
||||
sshSigningKey: "",
|
||||
botId: String(CLAUDE_APP_BOT_ID),
|
||||
|
||||
@@ -135,7 +135,7 @@ describe("pull_request_target event support", () => {
|
||||
const prompt = generatePrompt(envVars, mockGitHubData, false, "tag");
|
||||
|
||||
// Should include git commands for non-commit-signing mode
|
||||
expect(prompt).toContain("git push");
|
||||
expect(prompt).toContain("scripts/git-push.sh origin");
|
||||
expect(prompt).toContain(
|
||||
"Always push to the existing branch when triggered on a PR",
|
||||
);
|
||||
|
||||
@@ -35,6 +35,7 @@ describe("checkContainsTrigger", () => {
|
||||
labelTrigger: "",
|
||||
branchPrefix: "claude/",
|
||||
useStickyComment: false,
|
||||
classifyInlineComments: true,
|
||||
useCommitSigning: false,
|
||||
allowedBots: "",
|
||||
},
|
||||
@@ -63,6 +64,7 @@ describe("checkContainsTrigger", () => {
|
||||
labelTrigger: "",
|
||||
branchPrefix: "claude/",
|
||||
useStickyComment: false,
|
||||
classifyInlineComments: true,
|
||||
useCommitSigning: false,
|
||||
allowedBots: "",
|
||||
},
|
||||
@@ -275,6 +277,7 @@ describe("checkContainsTrigger", () => {
|
||||
labelTrigger: "",
|
||||
branchPrefix: "claude/",
|
||||
useStickyComment: false,
|
||||
classifyInlineComments: true,
|
||||
useCommitSigning: false,
|
||||
allowedBots: "",
|
||||
},
|
||||
@@ -304,6 +307,7 @@ describe("checkContainsTrigger", () => {
|
||||
labelTrigger: "",
|
||||
branchPrefix: "claude/",
|
||||
useStickyComment: false,
|
||||
classifyInlineComments: true,
|
||||
useCommitSigning: false,
|
||||
allowedBots: "",
|
||||
},
|
||||
@@ -333,6 +337,7 @@ describe("checkContainsTrigger", () => {
|
||||
labelTrigger: "",
|
||||
branchPrefix: "claude/",
|
||||
useStickyComment: false,
|
||||
classifyInlineComments: true,
|
||||
useCommitSigning: false,
|
||||
allowedBots: "",
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user