File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,10 +68,37 @@ export async function triageIssue(input: {
6868 context ?: TriageContext ;
6969} ) : Promise < void > {
7070 const octokit = getGitHubClient ( ) ;
71- const context = input . context ?? ( await loadTriageContext ( input ) ) ;
72- const issue = context . issues . find (
71+ let context = input . context ;
72+ let issue = context ? .issues . find (
7373 ( candidate ) => candidate . number === input . issueNumber ,
7474 ) ;
75+ if ( ! context ) {
76+ const [ loaded , { data : current } ] = await Promise . all ( [
77+ loadTriageContext ( input ) ,
78+ octokit . rest . issues . get ( {
79+ owner : input . owner ,
80+ repo : input . repo ,
81+ issue_number : input . issueNumber ,
82+ } ) ,
83+ ] ) ;
84+ if ( current . pull_request ) return ;
85+ issue = {
86+ number : current . number ,
87+ title : current . title ,
88+ body : current . body ,
89+ state : current . state ,
90+ labels : labelNames ( current . labels ) ,
91+ } ;
92+ context = {
93+ ...loaded ,
94+ issues : [
95+ issue ,
96+ ...loaded . issues . filter (
97+ ( candidate ) => candidate . number !== issue ?. number ,
98+ ) ,
99+ ] ,
100+ } ;
101+ }
75102 if ( ! issue ) throw new Error ( `Issue #${ input . issueNumber } was not found` ) ;
76103
77104 const candidates = rankDuplicateCandidates ( issue , context . issues ) ;
You can’t perform that action at this time.
0 commit comments