feat: implement auto-merge for approved PRs and update workflow documentation

This commit is contained in:
Lauren ten Hoor
2026-02-16 14:34:08 +08:00
parent f7aa47102f
commit 25ce06e14f
15 changed files with 208 additions and 163 deletions

View File

@@ -149,6 +149,15 @@ export class GitLabProvider implements IssueProvider {
return { state: PrState.CLOSED, url: null };
}
async mergePr(issueId: number): Promise<void> {
const pat = `#${issueId}`;
const raw = await this.glab(["mr", "list", "--output", "json", "--state", "opened"]);
const mrs = JSON.parse(raw) as Array<{ iid: number; title: string; description: string }>;
const mr = mrs.find((m) => m.title.includes(pat) || (m.description ?? "").includes(pat));
if (!mr) throw new Error(`No open MR found for issue #${issueId}`);
await this.glab(["mr", "merge", String(mr.iid)]);
}
async addComment(issueId: number, body: string): Promise<void> {
// Pass message directly as argv — no shell escaping needed with spawn
await this.glab(["issue", "note", String(issueId), "--message", body]);