@@ -142,7 +142,7 @@ export async function createIssue(title, content, repository, { cli, req }) {
142
142
export async function pickReport ( report , { cli, req } ) {
143
143
const {
144
144
id, attributes : { title, cve_ids } ,
145
- relationships : { severity, weakness, reporter }
145
+ relationships : { severity, weakness, reporter, custom_field_values }
146
146
} = report ;
147
147
const link = `https://hackerone.com/reports/${ id } ` ;
148
148
const reportSeverity = {
@@ -165,16 +165,24 @@ export async function pickReport(report, { cli, req }) {
165
165
defaultAnswer : await getSupportedVersions ( )
166
166
} ) ;
167
167
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 ] ;
176
174
} 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
+ }
178
186
}
179
187
180
188
const summaryContent = await getSummary ( id , req ) ;
@@ -186,6 +194,7 @@ export async function pickReport(report, { cli, req }) {
186
194
severity : reportSeverity ,
187
195
summary : summaryContent ?? '' ,
188
196
patchAuthors,
197
+ prURL,
189
198
affectedVersions : versions . split ( ',' ) . map ( ( v ) => v . replace ( 'v' , '' ) . trim ( ) ) ,
190
199
link,
191
200
reporter : reporter . data . attributes . username
0 commit comments