Skip to content

54510 with a review

54510 with a review #9

name: Third Party Library Changes
on:
pull_request:
paths:
- 'src/wp-includes/ID3/**'
- 'src/wp-includes/IXR/**'
- 'src/wp-includes/PHPMailer/**'
- 'src/wp-includes/Requests/**'
- 'src/wp-includes/SimplePie/**'
- 'src/wp-includes/sodium_compat/**'
- 'src/wp-includes/Text/**'
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
jobs:
third-party-changed-files:
runs-on: ubuntu-latest
name: Check third party libraries
permissions:
issues: write
pull-requests: write
if: ${{ github.repository == 'johnbillion/wordpress-develop' }}
steps:
- name: Leave a review about third party libraries
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const { owner, repo } = context.repo;
const { number } = context.issue;
// Check for the presence of a review and bail early.
const reviews = ( await github.rest.pulls.listReviews( { owner, repo, pull_number: number } ) ).data;
const hasReview = reviews.some( comment =>
comment.user.type === 'Bot' && comment.body.includes( 'Third Party Files' )
);
if ( hasReview ) return;
github.rest.pulls.createReview( {
owner,
repo,
pull_number: number,
event: 'REQUEST_CHANGES',
body: `## :x: Third Party Files
This pull request modifies a third party library file. Changes to files in the following directories should be made to their respective upstream projects instead:
- \`src/wp-includes/ID3\`: [ID3](https://example.com)
- \`src/wp-includes/IXR\`: [IXR](https://example.com)
- \`src/wp-includes/PHPMailer\`: [PHPMailer](https://example.com)
- \`src/wp-includes/Requests\`: [Requests](https://example.com)
- \`src/wp-includes/SimplePie\`: [SimplePie](https://example.com)
- \`src/wp-includes/sodium_compat\`: [Sodium Compat](https://example.com)
- \`src/wp-includes/Text\`: [Text](https://example.com)
These changes need to be proposed and merged into the upstream projects before being included in WordPress.
`,
} );
- name: Fail the workflow run
run: |
# Fail the workflow run
echo -e "\033[31;1mThis pull request modifies a third party library file. These changes need to be proposed and merged into the upstream projects before being included in WordPress.\033[0m"
exit 1