mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
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:
@@ -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 });
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user