mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-08-22 03:18:54 +08:00
fix: strip unused ALL_INPUTS environment variable from Claude subprocess env (#1692)
This commit is contained in:
@@ -289,6 +289,10 @@ export function parseSdkOptions(options: ClaudeOptions): ParsedSdkOptions {
|
|||||||
delete env.ACTIONS_ID_TOKEN_REQUEST_URL;
|
delete env.ACTIONS_ID_TOKEN_REQUEST_URL;
|
||||||
delete env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;
|
delete env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;
|
||||||
|
|
||||||
|
// Remove ALL_INPUTS as it is only needed during initial setup to determine
|
||||||
|
// input presence (collectActionInputsPresence) and contains serialized workflow inputs.
|
||||||
|
delete env.ALL_INPUTS;
|
||||||
|
|
||||||
// Build system prompt option - default to claude_code preset
|
// Build system prompt option - default to claude_code preset
|
||||||
let systemPrompt: SdkOptions["systemPrompt"];
|
let systemPrompt: SdkOptions["systemPrompt"];
|
||||||
if (options.systemPrompt) {
|
if (options.systemPrompt) {
|
||||||
|
|||||||
@@ -620,5 +620,22 @@ describe("parseSdkOptions", () => {
|
|||||||
process.env = originalEnv;
|
process.env = originalEnv;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("should strip ALL_INPUTS from env", () => {
|
||||||
|
const originalEnv = { ...process.env };
|
||||||
|
process.env.ALL_INPUTS = JSON.stringify({
|
||||||
|
anthropic_api_key: "sk-ant-test-key",
|
||||||
|
github_token: "ghp_test_token",
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options: ClaudeOptions = {};
|
||||||
|
const result = parseSdkOptions(options);
|
||||||
|
|
||||||
|
expect(result.sdkOptions.env?.ALL_INPUTS).toBeUndefined();
|
||||||
|
} finally {
|
||||||
|
process.env = originalEnv;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user