mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-08-22 03:18:54 +08:00
ci: skip Claude-backed test jobs on fork PRs (#1655)
* ci: skip Claude-backed test jobs on fork PRs Jobs that run the action against the Claude API authenticate via workload identity federation, which fork PRs cannot mint an OIDC token for, so they always failed on external contributions. Gate each such job on the PR head repo matching the base repo; push and workflow_dispatch runs are unaffected. No-Verification-Needed: CI workflow config only, exercised by Actions on the PR * test: pin the bare remote's initial branch in fetch-depth test The shallow-clone case created its bare remote with a plain git init, so HEAD pointed at whatever init.defaultBranch resolves to (master on CI) while the test only pushed main. git clone --depth=1 implies --single-branch, and with a dangling remote HEAD it produces an empty, non-shallow clone, so the is-shallow assertion failed on runners whose default branch is not main. No-Verification-Needed: test-only change
This commit is contained in:
@@ -28,7 +28,16 @@ describe("setupBranch fetch depth", () => {
|
||||
repoDir = join(tempDir, "repo");
|
||||
const remoteDir = join(tempDir, "origin.git");
|
||||
|
||||
execFileSync("git", ["init", "--bare", remoteDir], { stdio: "pipe" });
|
||||
// Pin the remote's HEAD to main: with the default init.defaultBranch of
|
||||
// master it would dangle, and `git clone --depth=1` (which implies
|
||||
// --single-branch) then produces an empty, non-shallow clone.
|
||||
execFileSync(
|
||||
"git",
|
||||
["init", "--bare", "--initial-branch=main", remoteDir],
|
||||
{
|
||||
stdio: "pipe",
|
||||
},
|
||||
);
|
||||
execFileSync("git", ["init", repoDir], { stdio: "pipe" });
|
||||
git(["checkout", "-b", "main"]);
|
||||
git(["config", "user.email", "test@example.com"]);
|
||||
|
||||
Reference in New Issue
Block a user