Skip to content
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

Github workflow: add a PHP backport changes action #52096

Merged
merged 6 commits into from
Jul 18, 2023

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Jun 29, 2023

What?

This is just a proposal...

Adds a Github action that:

  • detects whether any PHP files have been added or changed in /lib, /phpunit or block-library directories
  • creates a comment on a PR to inquire about if those PHP changes required backporting
  • updates that comment as PHP changes are detected on push
  • updates the comment if it no longer finds PHP changes
Screenshot 2023-06-30 at 10 58 39 am Screenshot 2023-06-30 at 11 24 25 am

Nice to haves as a follow up (will probably require a custom Gutenberg action as the marketplace is a desert)

  • remove the comment when no PHP files are detected instead of updating it
  • add a "Needs PHP backport" label tentatively ? Might be an overkill as we can't be sure the PHP files require it

Why?

WordPress releases are hectic and would be made easier if plugin changes that are destined for Core are reviewed and tested against Core earlier.

How?

Adding a new github action YAML file.

Testing Instructions

  • Push some PHP changes in either the /phpunit, /lib or packages/block-library/src folders to this branch (just edit comments if you like) and see if the message is appears.
  • Make sure the PHP list of changes is updated in the comment as new additions/changes are pushed

@ramonjd ramonjd changed the title adding PHP changes action Github workflow: add a PHP backport changes action Jun 29, 2023
@github-actions github-actions bot added the Needs PHP backport Needs PHP backport to Core label Jun 29, 2023
@WordPress WordPress deleted a comment from github-actions bot Jun 29, 2023
@WordPress WordPress deleted a comment from github-actions bot Jun 29, 2023
@ramonjd ramonjd removed the Needs PHP backport Needs PHP backport to Core label Jun 29, 2023
@github-actions
Copy link

github-actions bot commented Jun 29, 2023

This pull request changed or added PHP files in previous commits, but none have been detected in the latest commit.

Thank you! ❤️

@github-actions github-actions bot added the Needs PHP backport Needs PHP backport to Core label Jun 29, 2023
@ramonjd ramonjd added [Type] Experimental Experimental feature or API. GitHub Actions Pull requests that update GitHub Actions code labels Jun 29, 2023
@ramonjd ramonjd force-pushed the try/php-detection-workflow branch from 3f4d26f to 7960733 Compare June 29, 2023 23:24
@ramonjd ramonjd removed the Needs PHP backport Needs PHP backport to Core label Jun 29, 2023
@ramonjd ramonjd force-pushed the try/php-detection-workflow branch 3 times, most recently from 0fed88c to 01836ac Compare June 30, 2023 00:44
@github-actions
Copy link

Flaky tests detected in f41cd81c206647fdfee0a6db6389501973e73c61.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5417943681
📝 Reported issues:

Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Couple of comments below but otherwise LGTM

*.{php}
lib/**
phpunit/**
packages/block-library/src/**
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove the block-library folder as those files get auto-generated from the core package update.

echo "Changed files:"
formatted_change_list=""
for file in ${{ steps.changed-files-php.outputs.all_changed_files }}; do
echo "$file was changed"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this if we're already outputting all the changed files in the formatted list?

Copy link
Member Author

Choose a reason for hiding this comment

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

I left it there in case we need to debug the script's steps by eyeballing the CI logs.

Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense!

Copy link
Contributor

@apeatling apeatling left a comment

Choose a reason for hiding this comment

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

I didn't test, but I say this is a good and reasonable change so let's do it. :)

Remove block library glob
@ramonjd ramonjd merged commit 3c34c48 into trunk Jul 18, 2023
@ramonjd ramonjd deleted the try/php-detection-workflow branch July 18, 2023 01:15
@github-actions github-actions bot added this to the Gutenberg 16.3 milestone Jul 18, 2023
westonruter added a commit that referenced this pull request Jul 18, 2023
* trunk: (36 commits)
  Use `_get_block_template_file` function and set $area variable. (#52708)
  Change Delete page menu item to Move to trash. (#52641)
  Search block: Enqueue view script through block.json (#52552)
  Patterns: fix bug with Create Patterns menu not showing in site editor page editing (#52671)
  Github workflow: add a PHP backport changes action (#52096)
  Add layout API documentation. (#52673)
  Show uncategorized patterns on the Editor > Patterns page (#52633)
  Patterns: Remove `reusable` text from menu once rename hint has been dismissed (#52664)
  Update locked pattern tooltips (#52497)
  Rich Text/Footnotes: fix getRichTextValues for useInnerBlocksProps.save (#52682)
  Use posts instead of template parts for navigation color tests (#52654)
  Site Editor: Don't allow creating template part on the Patterns page for non-block themes (#52656)
  Site Editor: Fix incorrect 'useSelect' usage (#52683)
  Update issue gardening automation with new label (#52173)
  i18n: Make the tab labels of `ColorGradientSettingsDropdown` component translatable (#52669)
  Post Content link color should not be applied to placeholder component links (#52367)
  [Mobile] Update toolbar icons and colors (#52336)
  Avoid copying global style presets via the styles compatibility hook (#52640)
  Show warning on removal of Post Template block in the site editor. (#52666)
  Backport tools: sort PRs to be cherry picked by merged/closed date (#52667)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GitHub Actions Pull requests that update GitHub Actions code [Type] Experimental Experimental feature or API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants