This adds the ability to run the command in dry-run mode by setting an env var of DRY_RUN=true.
Note that I've used a different way of accessing the env var here - ENV['var_name'] rather than ENV.fetch('var_name') as the latter will error if the variable doesn't exist, whereas the former will just return a default value of false.
How to test
Copy the env.example file to .env and populate as follows:
GITLAB_API_ENDPOINT=https://git.govpress.com/api/v4
GITLAB_WORDPRESS_PLUGINS_GROUP_ID=71
GH_ORG_NAME=dxw-wordpress-plugins
DEFAULT_BRANCH_NAME=master
GH_TEAM_ID=1234567 #this value will not be used so a random integer will do
GH_ACCOUNT_USERNAME=dxw-govpress-tools
GH_ACCOUNT_TOKEN=[the "mirror-gitlab-plugins" API token from the 1password entry for the github govpress tools service account]
GITLAB_ACCOUNT_USERNAME=govpress-tools
GITLAB_ACCOUNT_TOKEN=[the read-only API token from the 1password entry for the gitlab govpress tools service account]
DRY_RUN=true
Install act for testing GitHub actions locally: brew install act
Run the action: act -j mirror-gitlab-plugins --secret-file .env. It should run successfully, outputting that it is in dry run mode, and what actions it would take, without performing those actions.
This adds the ability to run the command in dry-run mode by setting an env var of
DRY_RUN=true
.Note that I've used a different way of accessing the env var here -
ENV['var_name']
rather thanENV.fetch('var_name')
as the latter will error if the variable doesn't exist, whereas the former will just return a default value of false.How to test
env.example
file to.env
and populate as follows:brew install act
act -j mirror-gitlab-plugins --secret-file .env
. It should run successfully, outputting that it is in dry run mode, and what actions it would take, without performing those actions.