chore: update src/lib/conflict-automation.ts

swadhinbiswas committed 8 months ago
fc08744
1 parent df89663
commit fc08744
1 file changed
+21 -5
Showing 1 changed file+21-5
▼src/lib/conflict-automation.ts
+21-5
10
10
import { simpleGit, SimpleGit } from "simple-git";
11
11
import { getStack, updateStackStatus } from "./stacks";
12
12
import { notifyPrEvent, notifyUserDm } from "./slack-notifications";
13
+import { resolveRepoPath } from "./git-storage";
13
14
14
15
export interface ConflictInfo {
15
16
hasConflict: boolean;
77
78
}
78
79
} catch (error) {
79
80
logger.error({ err: error }, "Error checking conflicts");
81
+ let baseSha = baseBranch;
82
+ let headSha = headBranch;
83
+ try {
84
+ baseSha = (await git.revparse([baseBranch])).trim();
85
+ } catch { }
86
+ try {
87
+ headSha = (await git.revparse([headBranch])).trim();
88
+ } catch { }
80
89
return {
81
90
hasConflict: false,
82
91
conflictingFiles: [],
83
- baseSha: "",
84
- headSha: "",
92
+ baseSha,
93
+ headSha,
85
94
canAutoResolve: false,
86
95
};
87
96
}
227
236
// Trigger rebase for remaining PRs
228
237
logger.info({ count: remainingPrs.length, stackId: stackEntry.stackId }, "Auto-rebasing PRs after merge");
229
238
230
- // This would typically be queued to a background job
231
- // For now, just log and update status
232
- await updateStackStatus(stackEntry.stackId);
239
+ const localRepoPath = await resolveRepoPath(repo.diskPath);
240
+ const baseBranch = stackInfo.stack.baseBranch || "main";
241
+ const result = await rebaseStack(localRepoPath, stackEntry.stackId, baseBranch);
242
+
243
+ if (!result.success) {
244
+ logger.warn(
245
+ { stackId: stackEntry.stackId, repositoryId, message: result.message },
246
+ "Auto-rebase after merge failed"
247
+ );
248
+ }
233
249
}
234
250
235
251
/**
236
252