@@ -142,7 +142,7 @@ export async function createIssue(title, content, repository, { cli, req }) {
142142export async function pickReport ( report , { cli, req } ) {
143143 const {
144144 id, attributes : { title, cve_ids } ,
145- relationships : { severity, weakness, reporter }
145+ relationships : { severity, weakness, reporter, custom_field_values }
146146 } = report ;
147147 const link = `https://hackerone.com/reports/${ id } ` ;
148148 const reportSeverity = {
@@ -165,16 +165,24 @@ export async function pickReport(report, { cli, req }) {
165165 defaultAnswer : await getSupportedVersions ( )
166166 } ) ;
167167
168- let patchAuthors = await cli . prompt (
169- 'Add github username of the authors of the patch (split by comma if multiple)' , {
170- questionType : 'input' ,
171- defaultAnswer : ''
172- } ) ;
173-
174- if ( ! patchAuthors ) {
175- patchAuthors = [ ] ;
168+ let prURL = '' ;
169+ let patchAuthors = [ ] ;
170+ if ( custom_field_values . data . length ) {
171+ prURL = custom_field_values . data [ 0 ] . attributes . value ;
172+ const { user } = await req . getPullRequest ( prURL ) ;
173+ patchAuthors = [ user . login ] ;
176174 } else {
177- patchAuthors = patchAuthors . split ( ',' ) . map ( ( p ) => p . trim ( ) ) ;
175+ patchAuthors = await cli . prompt (
176+ 'Add github username of the authors of the patch (split by comma if multiple)' , {
177+ questionType : 'input' ,
178+ defaultAnswer : ''
179+ } ) ;
180+
181+ if ( ! patchAuthors ) {
182+ patchAuthors = [ ] ;
183+ } else {
184+ patchAuthors = patchAuthors . split ( ',' ) . map ( ( p ) => p . trim ( ) ) ;
185+ }
178186 }
179187
180188 const summaryContent = await getSummary ( id , req ) ;
@@ -186,6 +194,7 @@ export async function pickReport(report, { cli, req }) {
186194 severity : reportSeverity ,
187195 summary : summaryContent ?? '' ,
188196 patchAuthors,
197+ prURL,
189198 affectedVersions : versions . split ( ',' ) . map ( ( v ) => v . replace ( 'v' , '' ) . trim ( ) ) ,
190199 link,
191200 reporter : reporter . data . attributes . username
0 commit comments