fix: configure git identity before conflict merge

This commit is contained in:
lezi-fun committed 2026-08-14 11:59:52 +08:00
1 parent c2f39d452b
commit d36668c5c7
2 files changed
+19 -11

No files matched your search

+15 -11
View File
@@ -124,6 +124,18 @@ export async function resolvePullRequestConflicts(
return false;
}
await runCommand("git", ["config", "user.name", config.botName], worktree, gitEnv);
await runCommand(
"git",
[
"config",
"user.email",
`${config.githubAppId ?? "41898282"}+${config.botName}@users.noreply.github.com`
],
worktree,
gitEnv
);
await runCommand(
"git",
["fetch", "--no-tags", "origin", `${params.baseBranch}:refs/remotes/origin/ghbot-base`],
@@ -241,17 +253,6 @@ export async function resolvePullRequestConflicts(
return false;
}
await runCommand("git", ["config", "user.name", config.botName], worktree, gitEnv);
await runCommand(
"git",
[
"config",
"user.email",
`${config.githubAppId ?? "41898282"}+${config.botName}@users.noreply.github.com`
],
worktree,
gitEnv
);
await runCommand(
"git",
["commit", "-m", `fix: resolve conflicts for PR #${params.pullNumber}`],
@@ -310,6 +311,9 @@ export function describeConflictResolutionFailure(error: unknown): string {
if (message.includes("refusing to merge unrelated histories") || message.includes("shallow")) {
return "Conflict repair could not prepare the merge because the PR checkout did not contain enough Git history. No commit was pushed.";
}
if (message.includes("committer identity unknown") || message.includes("empty ident name")) {
return "Conflict repair could not start the merge because the temporary Git worktree had no bot committer identity. No commit was pushed.";
}
if (
message.includes("write access to repository not granted") ||
message.includes("permission denied") ||