Make WordPress Core

Changeset 57178


Ignore:
Timestamp:
12/10/2023 10:34:12 AM (4 months ago)
Author:
zieladam
Message:

Build/Test Tools: Fix the workflow that posts a preview link on every Pull Request

Fixes a 403 error in the pull-request-comments.yml job by switching from a custom workflow dispatch call to the pull_request_target trigger.

Follow up to [57124], [57174].
Props ockham.
See #59416.

Location:
trunk/.github/workflows
Files:
2 edited

Legend:

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

    r57124 r57178  
    55  pull_request_target:
    66    types: [ 'opened' ]
    7   workflow_dispatch:
    8     inputs:
    9       pr_number:
    10         description: 'The pull request number to process.'
    11         required: true
    12         type: string
     7    branches:
     8      - trunk
    139
    1410# Cancels all previous workflow runs for pull requests that have not completed.
     
    1612  # The concurrency group contains the workflow name and the branch name for pull requests
    1713  # or the commit hash for any other events.
    18   group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.event_name == 'workflow_dispatch' && inputs.pr_number || github.sha }}
    19   cancel-in-progress: true
     14  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.event_name == 'workflow_dispatch' && github.event.number || github.sha }}
    2015
    2116# Disable permissions for all available scopes by default.
     
    3227    timeout-minutes: 5
    3328    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request_target' }}
    34 
    3529    steps:
    3630      - uses: wow-actions/welcome@72817eb31cda1de60f51893d80e2e82ce57f7e76 # v1.3.0
     
    8882      issues: write
    8983      pull-requests: write
    90     if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'workflow_dispatch' }}
     84    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request_target' }}
    9185    steps:
    9286      - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
     
    9791              owner: context.repo.owner,
    9892              repo: context.repo.repo,
    99               issue_number: context.payload.inputs.pr_number
     93              issue_number: ${{ github.event.number }}
    10094            };
    10195            const comments = ( await github.rest.issues.listComments( commentInfo ) ).data;
     
    123117            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.
    124118
    125             [Test this pull request with WordPress Playground](https://playground.wordpress.net/wordpress.html?pr=${ context.payload.inputs.pr_number }).
     119            [Test this pull request with WordPress Playground](https://playground.wordpress.net/wordpress.html?pr=${{ github.event.number }}).
    126120            `;
    127121
  • trunk/.github/workflows/test-build-processes.yml

    r57125 r57178  
    107107      directory: ${{ matrix.directory }}
    108108
    109   # Calls the Pull Request Commenting workflow to leave a comment detailing how to test the PR within WordPress Playground.
    110   playground-comment:
    111     name: Leave WordPress Playground details
    112     runs-on: ubuntu-latest
    113     permissions:
    114       actions: write
    115     continue-on-error: true
    116     needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos ]
    117     if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request' }}
    118 
    119     steps:
    120       - name: Dispatch workflow run
    121         uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
    122         with:
    123           retries: 2
    124           retry-exempt-status-codes: 418
    125           script: |
    126             github.rest.actions.createWorkflowDispatch({
    127               owner: context.repo.owner,
    128               repo: context.repo.repo,
    129               workflow_id: 'pull-request-comments.yml',
    130               ref: 'trunk',
    131               inputs: {
    132                 pr_number: '${{ github.event.number }}'
    133               }
    134             });
    135109
    136110  slack-notifications:
     
    140114      actions: read
    141115      contents: read
    142     needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos, playground-comment ]
     116    needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos ]
    143117    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    144118    with:
     
    155129    permissions:
    156130      actions: write
    157     needs: [ playground-comment ]
     131    needs: [ slack-notifications ]
    158132    if: |
    159133      always() &&
Note: See TracChangeset for help on using the changeset viewer.