mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-08-03 09:48:31 +08:00
* Add workload identity federation auth support Adds anthropic_federation_rule_id, anthropic_organization_id, anthropic_service_account_id, anthropic_workspace_id, and anthropic_oidc_audience inputs. When the federation rule and organization are set, the action fetches the workflow's GitHub Actions OIDC token, writes it to a file in RUNNER_TEMP, keeps it refreshed during execution, and points the Claude Code CLI at it via ANTHROPIC_IDENTITY_TOKEN_FILE so the CLI can exchange it for a short-lived access token instead of using a static API key. * Add WIF example workflow and base-action federation docs * Default workload identity OIDC audience to https://api.anthropic.com
61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
export function collectActionInputsPresence(): string {
|
|
const inputDefaults: Record<string, string> = {
|
|
trigger_phrase: "@claude",
|
|
assignee_trigger: "",
|
|
label_trigger: "claude",
|
|
base_branch: "",
|
|
branch_prefix: "claude/",
|
|
allowed_bots: "",
|
|
mode: "tag",
|
|
model: "",
|
|
anthropic_model: "",
|
|
fallback_model: "",
|
|
allowed_tools: "",
|
|
disallowed_tools: "",
|
|
custom_instructions: "",
|
|
direct_prompt: "",
|
|
override_prompt: "",
|
|
additional_permissions: "",
|
|
claude_env: "",
|
|
settings: "",
|
|
anthropic_api_key: "",
|
|
claude_code_oauth_token: "",
|
|
anthropic_federation_rule_id: "",
|
|
anthropic_organization_id: "",
|
|
anthropic_service_account_id: "",
|
|
anthropic_workspace_id: "",
|
|
anthropic_oidc_audience: "",
|
|
github_token: "",
|
|
max_turns: "",
|
|
use_sticky_comment: "false",
|
|
classify_inline_comments: "true",
|
|
use_commit_signing: "false",
|
|
ssh_signing_key: "",
|
|
};
|
|
|
|
const allInputsJson = process.env.ALL_INPUTS;
|
|
if (!allInputsJson) {
|
|
console.log("ALL_INPUTS environment variable not found");
|
|
return JSON.stringify({});
|
|
}
|
|
|
|
let allInputs: Record<string, string>;
|
|
try {
|
|
allInputs = JSON.parse(allInputsJson);
|
|
} catch (e) {
|
|
console.error("Failed to parse ALL_INPUTS JSON:", e);
|
|
return JSON.stringify({});
|
|
}
|
|
|
|
const presentInputs: Record<string, boolean> = {};
|
|
|
|
for (const [name, defaultValue] of Object.entries(inputDefaults)) {
|
|
const actualValue = allInputs[name] || "";
|
|
|
|
const isSet = actualValue !== defaultValue;
|
|
presentInputs[name] = isSet;
|
|
}
|
|
|
|
return JSON.stringify(presentInputs);
|
|
}
|