fix: Artificer GitHub SSH absolute-path git fetch

This commit is contained in:
Claude Code
2026-06-10 21:15:41 +08:00
parent b895f5d925
commit 7864eb8f04
5 changed files with 37 additions and 7 deletions
+22 -2
View File
@@ -262,7 +262,8 @@ function codexShellSandbox(policy: ExecutionPolicy): string {
}
function toolCredentialEnvVars(items: ToolCredentialProjection[]): JsonRecord[] {
return items.filter((item): item is ToolCredentialEnvProjection => item.kind === "env").map((item) => ({
return [
...items.filter((item): item is ToolCredentialEnvProjection => item.kind === "env").map((item) => ({
name: item.envName,
valueFrom: {
secretKeyRef: {
@@ -270,7 +271,26 @@ function toolCredentialEnvVars(items: ToolCredentialProjection[]): JsonRecord[]
key: item.secretKey,
},
},
}));
})),
...githubSshCommandEnvVars(items),
];
}
function githubSshCommandEnvVars(items: ToolCredentialProjection[]): JsonRecord[] {
const credential = items.find((item): item is ToolCredentialVolumeProjection => item.kind === "volume" && item.tool === "github" && item.purpose === "github-ssh");
if (!credential) return [];
const mountPath = credential.mountPath.replace(/\/+$/u, "");
return [{
name: "GIT_SSH_COMMAND",
value: [
"ssh",
"-F", `${mountPath}/config`,
"-i", `${mountPath}/id_ed25519`,
"-o", "IdentitiesOnly=yes",
"-o", "StrictHostKeyChecking=yes",
"-o", `UserKnownHostsFile=${mountPath}/known_hosts`,
].join(" "),
}];
}
function toolCredentialVolumeMounts(items: ToolCredentialProjection[]): JsonRecord[] {