@@ -30,15 +30,13 @@ export type PopularityLevel =
30
30
interface BotError {
31
31
readonly type : "error" ;
32
32
readonly now : Date ;
33
- readonly pr_number : number ;
34
33
readonly message : string ;
35
34
readonly author : string | undefined ;
36
35
}
37
36
38
37
interface BotEnsureRemovedFromProject {
39
38
readonly type : "remove" ;
40
39
readonly now : Date ;
41
- readonly pr_number : number ;
42
40
readonly message : string ;
43
41
readonly isDraft : boolean ;
44
42
}
@@ -185,13 +183,13 @@ export async function deriveStateForPR(
185
183
getDownloads = getMonthlyDownloadCount ,
186
184
now = new Date ( ) ,
187
185
) : Promise < BotResult > {
188
- if ( prInfo . author == null ) return botError ( prInfo . number , "PR author does not exist" ) ;
186
+ if ( prInfo . author == null ) return botError ( "PR author does not exist" ) ;
189
187
190
- if ( prInfo . isDraft ) return botEnsureRemovedFromProject ( prInfo . number , "PR is a draft" , true ) ;
191
- if ( prInfo . state !== PullRequestState . OPEN ) return botEnsureRemovedFromProject ( prInfo . number , "PR is not active" , false ) ;
188
+ if ( prInfo . isDraft ) return botEnsureRemovedFromProject ( "PR is a draft" ) ;
189
+ if ( prInfo . state !== PullRequestState . OPEN ) return botEnsureRemovedFromProject ( "PR is not active" ) ;
192
190
193
191
const headCommit = getHeadCommit ( prInfo ) ;
194
- if ( headCommit == null ) return botError ( prInfo . number , "No head commit found" ) ;
192
+ if ( headCommit == null ) return botError ( "No head commit found" ) ;
195
193
196
194
const author = prInfo . author . login ;
197
195
const isFirstContribution = prInfo . authorAssociation === CommentAuthorAssociation . FIRST_TIME_CONTRIBUTOR ;
@@ -207,7 +205,7 @@ export async function deriveStateForPR(
207
205
const pkgInfoEtc = await getPackageInfosEtc (
208
206
noNullish ( prInfo . files ?. nodes ) . map ( f => f . path ) . sort ( ) ,
209
207
prInfo . headRefOid , fetchFile , async name => await getDownloads ( name , lastPushDate ) ) ;
210
- if ( pkgInfoEtc instanceof Error ) return botError ( prInfo . number , pkgInfoEtc . message ) ;
208
+ if ( pkgInfoEtc instanceof Error ) return botError ( pkgInfoEtc . message ) ;
211
209
const { pkgInfo, popularityLevel } = pkgInfoEtc ;
212
210
213
211
const reviews = getReviews ( prInfo ) ;
@@ -236,12 +234,12 @@ export async function deriveStateForPR(
236
234
...getCIResult ( headCommit . checkSuites )
237
235
} ;
238
236
239
- function botError ( pr_number : number , message : string ) : BotError {
240
- return { type : "error" , now, message, pr_number , author : prInfo . author ?. login } ;
237
+ function botError ( message : string ) : BotError {
238
+ return { type : "error" , now, message, author : prInfo . author ?. login } ;
241
239
}
242
240
243
- function botEnsureRemovedFromProject ( pr_number : number , message : string , isDraft : boolean ) : BotEnsureRemovedFromProject {
244
- return { type : "remove" , now, pr_number , message, isDraft } ;
241
+ function botEnsureRemovedFromProject ( message : string ) : BotEnsureRemovedFromProject {
242
+ return { type : "remove" , now, message, isDraft : prInfo . isDraft } ;
245
243
}
246
244
}
247
245
0 commit comments