Make WordPress Core

Changeset 61135


Ignore:
Timestamp:
11/04/2025 06:27:29 PM (5 weeks ago)
Author:
desrosj
Message:

Build/Test Tools: Only open pull requests need testing instructions.

This adds some logic to avoid leaving automated comments with instructions to test in Playground when the pull request has been closed.

Props jeffpaul.
See #63170.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/pull-request-comments.yml

    r61050 r61135  
    131131            const issue_number = Number( fs.readFileSync( './NR' ) );
    132132
     133            core.info( `Checking pull request #${issue_number}.` );
     134
     135            // Confirm that the pull request is still open before leaving a comment.
     136            const pr = await github.rest.pulls.get({
     137              owner: context.repo.owner,
     138              repo: context.repo.repo,
     139              pull_number: issue_number,
     140            });
     141
     142            if ( pr.data.state !== 'open' ) {
     143              core.info( 'The pull request has been closed. No comment will be left.' );
     144              return;
     145            }
     146
    133147            // Comments are only added after the first successful build. Check for the presence of a comment and bail early.
    134148            const commentInfo = {
     
    142156            for ( const currentComment of comments ) {
    143157              if ( currentComment.user.type === 'Bot' && currentComment.body.includes( 'Test using WordPress Playground' ) ) {
     158                core.info( 'A comment with instructions to test within a Playground instance already exists.' );
    144159                return;
    145160              }
Note: See TracChangeset for help on using the changeset viewer.