mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@57178 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
18
.github/workflows/pull-request-comments.yml
vendored
18
.github/workflows/pull-request-comments.yml
vendored
@@ -4,19 +4,14 @@ name: Pull Request Comments
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [ 'opened' ]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
pr_number:
|
||||
description: 'The pull request number to process.'
|
||||
required: true
|
||||
type: string
|
||||
branches:
|
||||
- trunk
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for pull requests
|
||||
# or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.event_name == 'workflow_dispatch' && inputs.pr_number || github.sha }}
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.event_name == 'workflow_dispatch' && github.event.number || github.sha }}
|
||||
|
||||
# Disable permissions for all available scopes by default.
|
||||
# Any needed permissions should be configured at the job level.
|
||||
@@ -31,7 +26,6 @@ jobs:
|
||||
pull-requests: write
|
||||
timeout-minutes: 5
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request_target' }}
|
||||
|
||||
steps:
|
||||
- uses: wow-actions/welcome@72817eb31cda1de60f51893d80e2e82ce57f7e76 # v1.3.0
|
||||
with:
|
||||
@@ -87,7 +81,7 @@ jobs:
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'workflow_dispatch' }}
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request_target' }}
|
||||
steps:
|
||||
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
|
||||
with:
|
||||
@@ -96,7 +90,7 @@ jobs:
|
||||
const commentInfo = {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.payload.inputs.pr_number
|
||||
issue_number: ${{ github.event.number }}
|
||||
};
|
||||
const comments = ( await github.rest.issues.listComments( commentInfo ) ).data;
|
||||
|
||||
@@ -122,7 +116,7 @@ jobs:
|
||||
|
||||
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.
|
||||
|
||||
[Test this pull request with WordPress Playground](https://playground.wordpress.net/wordpress.html?pr=${ context.payload.inputs.pr_number }).
|
||||
[Test this pull request with WordPress Playground](https://playground.wordpress.net/wordpress.html?pr=${{ github.event.number }}).
|
||||
`;
|
||||
|
||||
github.rest.issues.createComment( commentInfo );
|
||||
|
||||
Reference in New Issue
Block a user