dxw-wordpress-plugins / mirror-wordpress-plugins

Mirrors WordPress.org plugins to GitHub as versioned repos for use by Whippet
0 stars 0 forks source link

Allow re-tagging of current version on force update #34

Closed RobjS closed 2 months ago

RobjS commented 2 months ago

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

  1. 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
  2. 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).