@@ -13,15 +13,19 @@ module.exports = async ({ github, context, core }) => {
1313 }
1414
1515 // We only want to comment on PRs that are opened ready for review with reviewers.
16- if (
17- context . payload . action !== "opened" ||
18- pr . draft ||
19- ! pr . requested_reviewers ||
20- pr . requested_reviewers . length === 0
21- ) {
22- core . info (
23- 'PR is a draft, has no reviewers, or this is not an "opened" event. Skipping.'
24- ) ;
16+ const hasIndividualReviewers = pr . requested_reviewers && pr . requested_reviewers . length > 0 ;
17+ const hasTeamReviewers = pr . requested_teams && pr . requested_teams . length > 0 ;
18+
19+ // Debug reviewer information
20+ core . debug ( `PR requested_reviewers: ${ JSON . stringify ( pr . requested_reviewers || [ ] ) } ` ) ;
21+ core . debug ( `PR requested_teams: ${ JSON . stringify ( pr . requested_teams || [ ] ) } ` ) ;
22+ core . debug ( `Has individual reviewers: ${ hasIndividualReviewers } ` ) ;
23+ core . debug ( `Has team reviewers: ${ hasTeamReviewers } ` ) ;
24+ core . debug ( `PR action: ${ context . payload . action } ` ) ;
25+ core . debug ( `PR is draft: ${ pr . draft } ` ) ;
26+
27+ if ( context . payload . action !== "opened" || pr . draft || ( ! hasIndividualReviewers && ! hasTeamReviewers ) ) {
28+ core . info ( 'PR is a draft, has no reviewers (individual or team), or this is not an "opened" event. Skipping.' ) ;
2529 return ;
2630 }
2731
@@ -36,9 +40,7 @@ module.exports = async ({ github, context, core }) => {
3640 issue_number : pr . number ,
3741 } ) ;
3842
39- const existingComment = comments . find ( ( comment ) =>
40- comment . body . includes ( commentIdentifier )
41- ) ;
43+ const existingComment = comments . find ( ( comment ) => comment . body . includes ( commentIdentifier ) ) ;
4244
4345 if ( existingComment ) {
4446 core . info ( "A PR draft nudge comment already exists on this PR." ) ;
0 commit comments