mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-24 15:34:13 +08:00
Compare commits
1 Commits
claude/iss
...
ashwin/tri
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f766f1151 |
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,36 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: ""
|
|
||||||
labels: bug
|
|
||||||
assignees: ""
|
|
||||||
---
|
|
||||||
|
|
||||||
**Describe the bug**
|
|
||||||
A clear and concise description of what the bug is.
|
|
||||||
|
|
||||||
**To Reproduce**
|
|
||||||
Steps to reproduce the behavior:
|
|
||||||
|
|
||||||
1. Go to '...'
|
|
||||||
2. Click on '....'
|
|
||||||
3. Scroll down to '....'
|
|
||||||
4. See error
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
A clear and concise description of what you expected to happen.
|
|
||||||
|
|
||||||
**Screenshots**
|
|
||||||
If applicable, add screenshots to help explain your problem.
|
|
||||||
|
|
||||||
**Workflow yml file**
|
|
||||||
If it's not sensitive, consider including a paste of your full Claude workflow.yml file.
|
|
||||||
|
|
||||||
**API Provider**
|
|
||||||
|
|
||||||
[ ] Anthropic First-Party API (default)
|
|
||||||
[ ] AWS Bedrock
|
|
||||||
[ ] GCP Vertex
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context about the problem here.
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,3 @@
|
|||||||
.DS_Store
|
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
**/.claude/settings.local.json
|
**/.claude/settings.local.json
|
||||||
|
|||||||
BIN
src/.DS_Store
vendored
Normal file
BIN
src/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -58,27 +58,10 @@ export function buildAllowedToolsString(
|
|||||||
|
|
||||||
export function buildDisallowedToolsString(
|
export function buildDisallowedToolsString(
|
||||||
customDisallowedTools?: string,
|
customDisallowedTools?: string,
|
||||||
allowedTools?: string,
|
|
||||||
): string {
|
): string {
|
||||||
let disallowedTools = [...DISALLOWED_TOOLS];
|
let allDisallowedTools = DISALLOWED_TOOLS.join(",");
|
||||||
|
|
||||||
// If user has explicitly allowed some hardcoded disallowed tools, remove them from disallowed list
|
|
||||||
if (allowedTools) {
|
|
||||||
const allowedToolsArray = allowedTools
|
|
||||||
.split(",")
|
|
||||||
.map((tool) => tool.trim());
|
|
||||||
disallowedTools = disallowedTools.filter(
|
|
||||||
(tool) => !allowedToolsArray.includes(tool),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let allDisallowedTools = disallowedTools.join(",");
|
|
||||||
if (customDisallowedTools) {
|
if (customDisallowedTools) {
|
||||||
if (allDisallowedTools) {
|
allDisallowedTools = `${allDisallowedTools},${customDisallowedTools}`;
|
||||||
allDisallowedTools = `${allDisallowedTools},${customDisallowedTools}`;
|
|
||||||
} else {
|
|
||||||
allDisallowedTools = customDisallowedTools;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return allDisallowedTools;
|
return allDisallowedTools;
|
||||||
}
|
}
|
||||||
@@ -665,7 +648,6 @@ export async function createPrompt(
|
|||||||
);
|
);
|
||||||
const allDisallowedTools = buildDisallowedToolsString(
|
const allDisallowedTools = buildDisallowedToolsString(
|
||||||
preparedContext.disallowedTools,
|
preparedContext.disallowedTools,
|
||||||
preparedContext.allowedTools,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
core.exportVariable("ALLOWED_TOOLS", allAllowedTools);
|
core.exportVariable("ALLOWED_TOOLS", allAllowedTools);
|
||||||
|
|||||||
@@ -51,9 +51,8 @@ export async function setupBranch(
|
|||||||
|
|
||||||
const branchName = prData.headRefName;
|
const branchName = prData.headRefName;
|
||||||
|
|
||||||
// Execute git commands to checkout PR branch (shallow fetch for performance)
|
// Execute git commands to checkout PR branch
|
||||||
// Fetch the branch with a depth of 20 to avoid fetching too much history, while still allowing for some context
|
await $`git fetch origin ${branchName}`;
|
||||||
await $`git fetch origin --depth=20 ${branchName}`;
|
|
||||||
await $`git checkout ${branchName}`;
|
await $`git checkout ${branchName}`;
|
||||||
|
|
||||||
console.log(`Successfully checked out PR branch for PR #${entityNumber}`);
|
console.log(`Successfully checked out PR branch for PR #${entityNumber}`);
|
||||||
@@ -99,8 +98,8 @@ export async function setupBranch(
|
|||||||
sha: currentSHA,
|
sha: currentSHA,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Checkout the new branch (shallow fetch for performance)
|
// Checkout the new branch
|
||||||
await $`git fetch origin --depth=1 ${newBranch}`;
|
await $`git fetch origin ${newBranch}`;
|
||||||
await $`git checkout ${newBranch}`;
|
await $`git checkout ${newBranch}`;
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
@@ -722,51 +722,4 @@ describe("buildDisallowedToolsString", () => {
|
|||||||
expect(parts).toContain("BadTool1");
|
expect(parts).toContain("BadTool1");
|
||||||
expect(parts).toContain("BadTool2");
|
expect(parts).toContain("BadTool2");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should remove hardcoded disallowed tools if they are in allowed tools", () => {
|
|
||||||
const customDisallowedTools = "BadTool1,BadTool2";
|
|
||||||
const allowedTools = "WebSearch,SomeOtherTool";
|
|
||||||
const result = buildDisallowedToolsString(
|
|
||||||
customDisallowedTools,
|
|
||||||
allowedTools,
|
|
||||||
);
|
|
||||||
|
|
||||||
// WebSearch should be removed from disallowed since it's in allowed
|
|
||||||
expect(result).not.toContain("WebSearch");
|
|
||||||
|
|
||||||
// WebFetch should still be disallowed since it's not in allowed
|
|
||||||
expect(result).toContain("WebFetch");
|
|
||||||
|
|
||||||
// Custom disallowed tools should still be present
|
|
||||||
expect(result).toContain("BadTool1");
|
|
||||||
expect(result).toContain("BadTool2");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should remove all hardcoded disallowed tools if they are all in allowed tools", () => {
|
|
||||||
const allowedTools = "WebSearch,WebFetch,SomeOtherTool";
|
|
||||||
const result = buildDisallowedToolsString(undefined, allowedTools);
|
|
||||||
|
|
||||||
// Both hardcoded disallowed tools should be removed
|
|
||||||
expect(result).not.toContain("WebSearch");
|
|
||||||
expect(result).not.toContain("WebFetch");
|
|
||||||
|
|
||||||
// Result should be empty since no custom disallowed tools provided
|
|
||||||
expect(result).toBe("");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should handle custom disallowed tools when all hardcoded tools are overridden", () => {
|
|
||||||
const customDisallowedTools = "BadTool1,BadTool2";
|
|
||||||
const allowedTools = "WebSearch,WebFetch";
|
|
||||||
const result = buildDisallowedToolsString(
|
|
||||||
customDisallowedTools,
|
|
||||||
allowedTools,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Hardcoded tools should be removed
|
|
||||||
expect(result).not.toContain("WebSearch");
|
|
||||||
expect(result).not.toContain("WebFetch");
|
|
||||||
|
|
||||||
// Only custom disallowed tools should remain
|
|
||||||
expect(result).toBe("BadTool1,BadTool2");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user