Before: if the script was run with FORCE_UPDATE set to true, the commit_and_tag method would fail when attempting to apply the tag for the current version, because that tag already exists. At this point, the update process for the plugin in question would stop, with the effect that no major version tag would be applied, even if no major version tag previously existed.
Now: if FORCE_UPDATE is set to true, we add -f to the tag command for the current main version tag, to prevent this error. It would probably be safe to always do this, regardless of whether FORCE_UPDATE is set or not, but as a precaution I'm only running it when that is set to true.
How to test
Checkout out main, and with DRY_RUN and FORCE_UPDATE set to true in your local .env file, run the ./mirror-wordpress-plugins. You should see a fatal: tag '[current-version]' already exists error for every plugin. You can also see these errors in the workflow run I triggered on GitHub with FORCE_UPDATE set to true: https://github.com/dxw-wordpress-plugins/mirror-gitlab-plugins/actions/runs/9988909689/job/27606388096
Checkout this branch and run ./mirror-wordpress-plugins again. Each repo should be successfully tagged (but not pushed, because we're in dry-run mode).
Before: if the script was run with
FORCE_UPDATE
set to true, thecommit_and_tag
method would fail when attempting to apply the tag for the current version, because that tag already exists. At this point, the update process for the plugin in question would stop, with the effect that no major version tag would be applied, even if no major version tag previously existed.Now: if
FORCE_UPDATE
is set to true, we add-f
to the tag command for the current main version tag, to prevent this error. It would probably be safe to always do this, regardless of whetherFORCE_UPDATE
is set or not, but as a precaution I'm only running it when that is set to true.How to test
main
, and withDRY_RUN
andFORCE_UPDATE
set to true in your local .env file, run the./mirror-wordpress-plugins
. You should see afatal: tag '[current-version]' already exists
error for every plugin. You can also see these errors in the workflow run I triggered on GitHub withFORCE_UPDATE
set to true: https://github.com/dxw-wordpress-plugins/mirror-gitlab-plugins/actions/runs/9988909689/job/27606388096./mirror-wordpress-plugins
again. Each repo should be successfully tagged (but not pushed, because we're in dry-run mode).