Skip to content

Commit

Permalink
initial commit adding PHP changes action
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Jun 29, 2023
1 parent 47b60e5 commit 01836ac
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 4 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/php-changes-detection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: OPTIONAL - Confirm if PHP changes require backporting to WordPress Core

on:
pull_request:
types: [opened, synchronize]
jobs:
detect_php_changes:
name: Detect PHP changes
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
fetch-depth: 0
- name: Get changed PHP files
id: changed-files-php
uses: tj-actions/changed-files@v37
with:
files: |
*.{php}
lib/**
phpunit/**
packages/block-library/src/**
- name: List all changed files
if: steps.changed-files-php.outputs.any_changed == 'true'
id: list-changed-php-files
run: |
echo "Changed files:"
formatted_change_list=""
for file in ${{ steps.changed-files-php.outputs.all_changed_files }}; do
echo "$file was changed"
formatted_change_list+="<br>:grey_question: $file"
done
formatted_change_list+="<br>"
echo "formatted_change_list=$formatted_change_list" >> $GITHUB_OUTPUT
- name: Update PR comment
if: steps.changed-files-php.outputs.any_changed == 'true'
uses: edumserrano/find-create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: '<!-- pr-contains-php-changes -->'
comment-author: 'github-actions[bot]'
body: |
<!-- pr-contains-php-changes -->
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.
If so, it is recommended to create a [new Trac ticket](https://core.trac.wordpress.org/newticket) and submit a pull request to the [WordPress Core Github repository](https://github.com/WordPress/wordpress-develop) soon after this pull request is merged.
If you're unsure, you can always ask for help in the #core-editor channel in [WordPress Slack](https://make.wordpress.org/chat/).
Thank you! :heart:
<details>
<summary>View changed files</summary>
${{ steps.list-changed-php-files.outputs.formatted_change_list }}
</details>
edit-mode: replace
2 changes: 1 addition & 1 deletion lib/blocks.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Block functions specific for the Gutenberg editor plugin.
* Block functions specific to the Gutenberg editor plugin.
*
* @package gutenberg
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/global-styles-and-settings.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* API to interact with global settings & styles.
* API to interact with global settings and styles.
*
* @package gutenberg
*/
Expand Down
6 changes: 4 additions & 2 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ function gutenberg_is_experiment_enabled( $name ) {
return ! empty( $experiments[ $name ] );
}

// These files only need to be loaded if within a rest server instance
// which this class will exist if that is the case.
/*
* These files only need to be loaded if within a rest server instance.
* WP_REST_Controller will exist if that is the case.
*/
if ( class_exists( 'WP_REST_Controller' ) ) {
if ( ! class_exists( 'WP_REST_Block_Editor_Settings_Controller' ) ) {
require_once __DIR__ . '/experimental/class-wp-rest-block-editor-settings-controller.php';
Expand Down

0 comments on commit 01836ac

Please sign in to comment.