This PR adds an initial version of the script to apply major version tags to all projects in this org, independently from the mirror-wordpress-plugins script. The intention is that major version tagging will be removed from the mirror script in a future plugin when this script is fully activated, so that the two can run separately. This will allow us to automatically generate major version tags for plugins that are manually updated, as well as those that are mirrored from WordPress.
The script checks which repos in this org have been updated in the past 12 hours, and then applies major version tags to those. The major version tag is based on the highest full semver tag currently applied to the repo in question, and the major version tag is then applied to the same commit that the full semver tag points to (rather than to the HEAD commit of the default branch). This should ensure that, in the unlikely event that the repo is updated with a new major version while this script is running, we don't accidentally end up with the incorrect major version tag pointing at the new major version.
Given that we'll be running this script on a schedule more than once every 12 hours, the logic will result in us re-applying major version tags to repos that already have them correctly applied. However, no changes will actually result from this, so it should be safe to take this approach.
Currently, the script is set up so that even if it is accidentally run in non-dry-run mode, it will not push anything to GitHub.
How to test
Populate you local .env file based on .env.example. Set TAGGER_DRY_RUN to true, and TAGGER_FORCE_UPDATE to false.
Run the script: ./apply-major-version-tags. You should get an output along the lines of:
==> Updated the following 3 plugin(s):
cookie-law-info v3.2.5 tagged as v3
mappress-google-maps-for-wordpress v2.92.1 tagged as v2
wpdatatables v3.4.2.20 tagged as v3
(Depending on which plugins were updated in the past 12 hours).
This PR adds an initial version of the script to apply major version tags to all projects in this org, independently from the
mirror-wordpress-plugins
script. The intention is that major version tagging will be removed from the mirror script in a future plugin when this script is fully activated, so that the two can run separately. This will allow us to automatically generate major version tags for plugins that are manually updated, as well as those that are mirrored from WordPress.The script checks which repos in this org have been updated in the past 12 hours, and then applies major version tags to those. The major version tag is based on the highest full semver tag currently applied to the repo in question, and the major version tag is then applied to the same commit that the full semver tag points to (rather than to the HEAD commit of the default branch). This should ensure that, in the unlikely event that the repo is updated with a new major version while this script is running, we don't accidentally end up with the incorrect major version tag pointing at the new major version.
Given that we'll be running this script on a schedule more than once every 12 hours, the logic will result in us re-applying major version tags to repos that already have them correctly applied. However, no changes will actually result from this, so it should be safe to take this approach.
Currently, the script is set up so that even if it is accidentally run in non-dry-run mode, it will not push anything to GitHub.
How to test
.env
file based on.env.example
. SetTAGGER_DRY_RUN
totrue
, andTAGGER_FORCE_UPDATE
to false../apply-major-version-tags
. You should get an output along the lines of:(Depending on which plugins were updated in the past 12 hours).