-
Notifications
You must be signed in to change notification settings - Fork 3.3k
#54510 Add action for third party library changes #6544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
37b7665
128ae4b
86f381e
b284c87
e5db463
d5f58e6
da612c4
fa263ee
b2f4a4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: Third Party Library Changes | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also add |
||
| - '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: Get third party library modified files | ||
| permissions: | ||
| issues: write | ||
| pull-requests: write | ||
| if: ${{ github.repository == 'johnbillion/wordpress-develop' }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just making note to change this on commit. |
||
| steps: | ||
| - name: Leave a comment about third party libraries | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wondering if we should follow the reusable workflow pattern that is now everywhere to make updating this easier in the future. |
||
| 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 comment and bail early. | ||
| const comments = ( await github.rest.issues.listComments( { owner, repo, issue_number: number } ) ).data; | ||
|
|
||
| const hasComment = comments.some( comment => | ||
| comment.user.type === 'Bot' && comment.body.includes( 'Third Party Files' ) | ||
| ); | ||
|
|
||
| if ( hasComment ) return; | ||
|
|
||
| github.rest.issues.createComment( { | ||
| owner, | ||
| repo, | ||
| issue_number: number, | ||
| body: `## 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: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A good follow up item, but I wonder if we could extract these messages into |
||
|
|
||
| - \`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: exit 1 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also run this on
pushjust as a sanity check? In case someone is not using GitHub to stage changes and run tests?