Changeset 57210
- Timestamp:
- 12/20/2023 02:50:11 PM (14 months ago)
- Location:
- trunk/.github/workflows
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.github/workflows/pull-request-comments.yml
r57197 r57210 5 5 pull_request_target: 6 6 types: [ 'opened' ] 7 branches: 8 - trunk 7 workflow_run: 8 workflows: [ 'Test Build Processes' ] 9 types: 10 - completed 9 11 10 12 # Cancels all previous workflow runs for pull requests that have not completed. … … 28 30 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request_target' }} 29 31 steps: 30 - uses: wow-actions/welcome@72817eb31cda1de60f51893d80e2e82ce57f7e76 # v1.3.0 32 - name: Post a welcome comment 33 uses: wow-actions/welcome@72817eb31cda1de60f51893d80e2e82ce57f7e76 # v1.3.0 31 34 with: 32 35 FIRST_PR_REACTIONS: 'hooray' … … 82 85 issues: write 83 86 pull-requests: write 84 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request_target' }} 87 if: > 88 github.repository == 'WordPress/wordpress-develop' && 89 github.event.workflow_run.event == 'pull_request' && 90 github.event.workflow_run.conclusion == 'success' 85 91 steps: 86 - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 92 - name: Download artifact 93 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 87 94 with: 88 95 script: | 96 const artifacts = await github.rest.actions.listWorkflowRunArtifacts( { 97 owner: context.repo.owner, 98 repo: context.repo.repo, 99 run_id: ${{ github.event.workflow_run.id }}, 100 } ); 101 102 const matchArtifact = artifacts.data.artifacts.filter( ( artifact ) => { 103 return artifact.name === 'pr-number' 104 } )[0]; 105 106 if ( ! matchArtifact ) { 107 core.setFailed( 'No artifact found!' ); 108 return; 109 } 110 111 const download = await github.rest.actions.downloadArtifact( { 112 owner: context.repo.owner, 113 repo: context.repo.repo, 114 artifact_id: matchArtifact.id, 115 archive_format: 'zip', 116 } ); 117 118 const fs = require( 'fs' ); 119 fs.writeFileSync( '${{github.workspace}}/pr-number.zip', Buffer.from( download.data ) ) 120 121 - name: Unzip the artifact containing the PR number 122 run: unzip pr-number.zip 123 124 - name: Leave a comment about testing with Playground 125 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 126 with: 127 script: | 128 const fs = require( 'fs' ); 129 const issue_number = Number( fs.readFileSync( './NR' ) ); 130 89 131 // Comments are only added after the first successful build. Check for the presence of a comment and bail early. 90 132 const commentInfo = { 91 133 owner: context.repo.owner, 92 134 repo: context.repo.repo, 93 issue_number : ${{ github.event.number }}135 issue_number, 94 136 }; 137 95 138 const comments = ( await github.rest.issues.listComments( commentInfo ) ).data; 96 139 … … 117 160 For more details about these limitations and more, check out the [Limitations page](https://wordpress.github.io/wordpress-playground/limitations/) in the WordPress Playground documentation. 118 161 119 [Test this pull request with WordPress Playground](https://playground.wordpress.net/wordpress.html?pr=${ { github.event.number }}).162 [Test this pull request with WordPress Playground](https://playground.wordpress.net/wordpress.html?pr=${ issue_number }). 120 163 `; 121 164 -
trunk/.github/workflows/test-build-processes.yml
r57197 r57210 107 107 directory: ${{ matrix.directory }} 108 108 109 # Uploads the PR number as an artifact for the Pull Request Commenting workflow to download and then 110 # leave a comment detailing how to test the PR within WordPress Playground. 111 playground-comment: 112 name: Leave WordPress Playground details 113 runs-on: ubuntu-latest 114 permissions: 115 actions: write 116 continue-on-error: true 117 needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos ] 118 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request' }} 119 120 steps: 121 - name: Save PR number 122 run: | 123 mkdir -p ./pr-number 124 echo ${{ github.event.number }} > ./pr-number/NR 125 126 - name: Upload PR number as artifact 127 uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 128 with: 129 name: pr-number 130 path: pr-number/ 109 131 110 132 slack-notifications:
Note: See TracChangeset
for help on using the changeset viewer.