@@ -30,15 +30,13 @@ export type PopularityLevel =
3030interface BotError {
3131 readonly type : "error" ;
3232 readonly now : Date ;
33- readonly pr_number : number ;
3433 readonly message : string ;
3534 readonly author : string | undefined ;
3635}
3736
3837interface BotEnsureRemovedFromProject {
3938 readonly type : "remove" ;
4039 readonly now : Date ;
41- readonly pr_number : number ;
4240 readonly message : string ;
4341 readonly isDraft : boolean ;
4442}
@@ -185,13 +183,13 @@ export async function deriveStateForPR(
185183 getDownloads = getMonthlyDownloadCount ,
186184 now = new Date ( ) ,
187185) : 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" ) ;
189187
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" ) ;
192190
193191 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" ) ;
195193
196194 const author = prInfo . author . login ;
197195 const isFirstContribution = prInfo . authorAssociation === CommentAuthorAssociation . FIRST_TIME_CONTRIBUTOR ;
@@ -207,7 +205,7 @@ export async function deriveStateForPR(
207205 const pkgInfoEtc = await getPackageInfosEtc (
208206 noNullish ( prInfo . files ?. nodes ) . map ( f => f . path ) . sort ( ) ,
209207 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 ) ;
211209 const { pkgInfo, popularityLevel } = pkgInfoEtc ;
212210
213211 const reviews = getReviews ( prInfo ) ;
@@ -236,12 +234,12 @@ export async function deriveStateForPR(
236234 ...getCIResult ( headCommit . checkSuites )
237235 } ;
238236
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 } ;
241239 }
242240
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 } ;
245243 }
246244}
247245
0 commit comments