Skip to content

Determine WordPress and WooCommerce plugin versions dynamically via GitHub Actions #4289

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

Merged
merged 20 commits into from
May 19, 2025

Conversation

daledupreez
Copy link
Contributor

@daledupreez daledupreez commented May 2, 2025

Changes proposed in this Pull Request:

While working on some tests, I noticed that our unit test matrix for WordPress is currently missing 6.8 (and had 6.6 duplicated due to WooCommerce <-> WordPress compatibility), and we also haven't picked up the most recent minor release of WooCommerce. I then spent some time exploring whether we could automate building the most recent versions using GitHub Actions, and put together the actions in this PR to get the n most recent releases of WordPress and any specified plugin, and then wired them into our PHP unit test testing matrix.

As a side effect, we've added WordPress 6.8.1 instead of 6.6, and we picked up the recent WooCommerce patch release.

It's possible that both actions will be useful to more folks in the WordPress community, so I plan to kick off a discussion about publishing these actions for broader internal use.

Implementation notes

The approach for both actions is fairly similar:

  • Make an API call to api.wordpress.org to get (WordPress releases | plugin details) in JSON format
  • Use jq to filter that down to a list of releases, and filter out suffixed releases, e.g. -beta, -rc1 etc
  • Use jq to group by major.minor version, and then pick only the most recent release for each major.minor version, e.g. we group WordPress 6.7.2, 6.7.1, and 6.7.0, but we then filter down to 6.7.2
  • Output the requested number of versions as both JSON and newline-separated text

The one minor difference (for now) is that the WordPress list uses an hourly file cache. That may or may not be something that makes sense in the long run.

Testing instructions

The new actions and their wiring are already in place!

  • Check the PHP tests / get-wordpress-versions log in the tests below, and verify that the logs show us fetching the most recent WordPress versions
  • Check the PHP tests / get-woocommerce-versions log in the tests below, and verify that the logs show us fetching the set of recent WooCommerce releases
  • Check the various PHP tests / Stable * logs to verify that we're running with the right versions of

  • Covered with tests (or have a good reason not to test in description ☝️)
  • [N/A] Tested on mobile (or does not apply)

Changelog entry

  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Comment

Comment

Post merge

@daledupreez daledupreez marked this pull request as ready for review May 5, 2025 14:02
@daledupreez daledupreez self-assigned this May 5, 2025
@daledupreez daledupreez added type: technical debt This issue/PR represents/solves the technical debt of the project. type: task The issue is an internally driven task (e.g. from another A8c team). labels May 5, 2025
@daledupreez daledupreez requested review from annemirasol and Mayisha May 5, 2025 14:32
@daledupreez daledupreez changed the title Explore building plugin versions dynamically Determine WordPress and WooCommerce plugin versions dynamically via GitHub Actions May 13, 2025
Copy link
Contributor

@annemirasol annemirasol left a comment

Choose a reason for hiding this comment

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

This looks good! 🚢

If we plan to publish broadly, we should probably sanitize plugin-slug.

@daledupreez daledupreez merged commit dc9cad8 into develop May 19, 2025
52 of 53 checks passed
@daledupreez daledupreez deleted the try/add-action-to-fetch-wp-plugin-versions branch May 19, 2025 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task The issue is an internally driven task (e.g. from another A8c team). type: technical debt This issue/PR represents/solves the technical debt of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants