Make WordPress Core


Ignore:
Timestamp:
12/10/2023 10:34:12 AM (10 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.

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.