Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/third-party-library-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Third Party Library Changes

on:
pull_request:
Copy link
Member

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 push just as a sanity check? In case someone is not using GitHub to stage changes and run tests?

paths:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also add branch qualifiers? Maybe trunk, and 6.[7-9]/[7-9].[0-9] to run on the current version and all future ones?

- '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' }}
Copy link
Member

Choose a reason for hiding this comment

The 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
Copy link
Member

Choose a reason for hiding this comment

The 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:
Copy link
Member

Choose a reason for hiding this comment

The 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 .md files and pull them in instead of including the comment contents inline. Could make editing and tracking updates much easier. But may not help if there's a need for ${{ github.context }} style substitutions.


- \`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
2 changes: 1 addition & 1 deletion src/wp-includes/Requests/src/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
use WpOrg\Requests\Utility\InputValidator;

/**
* Requests for PHP
* Responses for PHP
*
* Inspired by Requests for Python.
*
Expand Down