Compare plugin versions when deciding whether to deploy - #2620
Open
westonruter wants to merge 1 commit into
Open
Compare plugin versions when deciding whether to deploy#2620westonruter wants to merge 1 commit into
westonruter wants to merge 1 commit into
Conversation
The "Check if deployment is needed" step only halted when the version on WordPress.org was string-equal to the version being built. If the version on WordPress.org was *newer* than the one in the branch, the check passed and the deployment proceeded, overwriting a newer release with an older one. Replace the equality test with `version_compare()` so the deployment halts whenever the WordPress.org version is greater than or equal to the version being deployed. This also fixes the string comparison itself, which would have treated 1.10.0 and 1.9.0 as unequal without regard for which is actually newer. The notice now names both versions so the reason for halting is visible in the job log. Add a `setup-php` step, pinned to the same SHA already used by `php-lint.yml`, `plugin-check.yml`, and `copilot-setup-steps.yml`. PHP is preinstalled on the `ubuntu-latest` image, but relying on that would fail open: a missing `php` binary exits non-zero, the check would read as "versions differ", and the deployment would proceed. Setting PHP up explicitly makes that case fail the job instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
westonruter
requested review from
mukeshpanchal27 and
thelovekesh
as code owners
August 7, 2026 19:35
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is something I noticed while working on #2619. I wasn't comfortable using the regular workflow for deployments of all plugins when a tag was created because the "Check if deployment is needed" step only halts when the version on WordPress.org is string-equal to the version being built:
So if the version on WordPress.org is newer than the one in the branch, the versions are unequal, the check passes, and the deployment proceeds — overwriting a newer release with an older one. Being a string comparison, it is also blind to ordering generally:
1.10.0and1.9.0are simply "not equal".Relevant technical choices
Swapped the equality test for
version_compare(), halting whenever the WordPress.org version is>=the version being deployed:Verified against the cases that matter:
1.2.01.2.01.3.01.2.01.10.01.9.01.2.01.3.01.2.0-beta11.2.0The
::notice::now names both versions, so the job log says why it stopped rather than just asserting the plugin is up to date.Also added a
setup-phpstep, pinned to the same SHA already used byphp-lint.yml,plugin-check.yml, andcopilot-setup-steps.yml. PHP is preinstalled on theubuntu-latestimage, sophp -rwould work without it — but relying on that fails open: a missingphpbinary exits non-zero, theifreads as "versions differ", and the deployment proceeds. Setting PHP up explicitly turns that into a failed job instead. I usedphp-version: latest(as inphp-lint.yml) sinceversion_compare()behavior is stable across versions; happy to pin it to'8.3'to matchplugin-check.ymlif preferred.Testing instructions
The changed step can be exercised standalone:
Note that the workflow itself only runs on release, so this path is not exercised by CI on this PR.
Use of AI Tools
Claude Code wrote the change and this description, at my direction, after I spotted the faulty comparison and specified the
version_compare()fix and thesetup-phpaddition. I reviewed both the diff and the verification output.🤖 Generated with Claude Code