feat: include issue comments in worker task context (#148)

This commit is contained in:
Lauren ten Hoor
2026-02-13 16:49:15 +08:00
parent 54fabe1197
commit c0b3e15581
6 changed files with 56 additions and 3 deletions

View File

@@ -52,6 +52,21 @@ export class GitLabProvider implements IssueProvider {
return JSON.parse(raw) as Issue;
}
async listComments(issueId: number): Promise<import("./provider.js").IssueComment[]> {
try {
const raw = await this.glab(["api", `projects/:id/issues/${issueId}/notes`, "--paginate"]);
const notes = JSON.parse(raw) as Array<{ author: { username: string }; body: string; created_at: string; system: boolean }>;
// Filter out system notes (e.g. "changed label", "closed issue")
return notes
.filter((note) => !note.system)
.map((note) => ({
author: note.author.username,
body: note.body,
created_at: note.created_at,
}));
} catch { return []; }
}
async transitionLabel(issueId: number, from: StateLabel, to: StateLabel): Promise<void> {
const issue = await this.getIssue(issueId);
const stateLabels = issue.labels.filter((l) => STATE_LABELS.includes(l as StateLabel));