fix(triage): replace timelineItems with separate gh pr open search

Remove the unsupported `timelineItems` field from `ghIssueView`, add
`ghPrSearchOpen` wrapper, and synthesize `issue.timelineItems` in the
main loop so `classifyIssue` stays unchanged.
This commit is contained in:
diegosouzapw
2026-05-19 03:33:58 -03:00
parent 7c11b952a7
commit 6f6837d070
3 changed files with 35 additions and 7 deletions

View File

@@ -144,6 +144,18 @@ async function main(argv, env, deps = defaultDeps) {
continue;
}
// Synthesize timelineItems from open PR search (gh issue view doesn't expose timelineItems)
let openPrs = [];
try {
openPrs = deps.ghPrSearchOpen(args.owner, args.repo, num);
} catch (e) {
warnings.push({ level: "warn", issue: num, message: `open PR search failed: ${e.message}` });
}
issue.timelineItems = openPrs.map((pr) => ({
__typename: "CrossReferencedEvent",
source: { __typename: "PullRequest", state: "OPEN", number: pr.number },
}));
const mergedPrs = deps.ghPrSearchMerged(args.owner, args.repo, num);
const gitCommits = deps.gitLogGrep(`#${num}`).filter((c) => deps.gitIsAncestor(c.hash, "main"));
const del = detectDelivered(num, { mergedPrs, changelog: changelogText, gitCommits });

View File

@@ -61,7 +61,24 @@ export function ghIssueView(owner, repo, number) {
"--repo",
`${owner}/${repo}`,
"--json",
"number,title,url,body,state,stateReason,labels,author,assignees,createdAt,closedAt,comments,reactionGroups,timelineItems",
"number,title,url,body,state,stateReason,labels,author,assignees,createdAt,closedAt,comments,reactionGroups",
]);
}
export function ghPrSearchOpen(owner, repo, issueNumber) {
return runJson("gh", [
"pr",
"list",
"--repo",
`${owner}/${repo}`,
"--state",
"open",
"--search",
`#${issueNumber}`,
"--json",
"number,title,body",
"--limit",
"10",
]);
}
@@ -141,6 +158,7 @@ export const defaultDeps = {
ghIssueListFeatureTitled,
ghIssueView,
ghPrSearchMerged,
ghPrSearchOpen,
gitTagsByDate,
gitLogGrep,
gitIsAncestor,