fix: support pinned local base action

This commit is contained in:
Mark Wylde
2026-08-07 22:24:48 +01:00
parent 7acc140d45
commit 6f6b9c0489
2 changed files with 51 additions and 0 deletions
+14
View File
@@ -61,6 +61,10 @@ inputs:
description: "Timeout in minutes for Claude Code execution"
required: false
default: "10"
path_to_claude_code_executable:
description: "Path to a custom Claude Code executable to use instead of installing"
required: false
default: ""
# Authentication settings
anthropic_api_key:
@@ -114,11 +118,21 @@ runs:
bun install
- name: Install Claude Code
if: inputs.path_to_claude_code_executable == ''
shell: bash
run: |
curl -fsSL https://claude.ai/install.sh | bash -s 2.1.173
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Use custom Claude Code executable
if: inputs.path_to_claude_code_executable != ''
shell: bash
env:
CLAUDE_CODE_EXECUTABLE: ${{ inputs.path_to_claude_code_executable }}
run: |
echo "Using custom Claude Code executable: $CLAUDE_CODE_EXECUTABLE"
echo "$(dirname "$CLAUDE_CODE_EXECUTABLE")" >> "$GITHUB_PATH"
- name: Run Claude Code Action
shell: bash
id: run_claude
+37
View File
@@ -0,0 +1,37 @@
import { afterEach, beforeEach, describe, expect, spyOn, test } from "bun:test";
import * as core from "@actions/core";
import { setupGitHubToken } from "../src/github/token";
describe("setupGitHubToken", () => {
const originalEnv = { ...process.env };
let setOutputSpy: ReturnType<typeof spyOn>;
let logSpy: ReturnType<typeof spyOn>;
beforeEach(() => {
delete process.env.OVERRIDE_GITHUB_TOKEN;
delete process.env.GITHUB_TOKEN;
setOutputSpy = spyOn(core, "setOutput").mockImplementation(() => {});
logSpy = spyOn(console, "log").mockImplementation(() => {});
});
afterEach(() => {
setOutputSpy.mockRestore();
logSpy.mockRestore();
process.env = { ...originalEnv };
});
test("prefers the explicit Gitea token", async () => {
process.env.OVERRIDE_GITHUB_TOKEN = "gitea-token";
process.env.GITHUB_TOKEN = "workflow-token";
expect(await setupGitHubToken()).toBe("gitea-token");
expect(setOutputSpy).toHaveBeenCalledWith("GITHUB_TOKEN", "gitea-token");
});
test("falls back to the workflow token without requesting OIDC", async () => {
process.env.GITHUB_TOKEN = "workflow-token";
expect(await setupGitHubToken()).toBe("workflow-token");
expect(setOutputSpy).toHaveBeenCalledWith("GITHUB_TOKEN", "workflow-token");
});
});