diff --git a/src/commands/install_plugin.yml b/src/commands/install_plugin.yml index 26ffc5c..fc6df7b 100644 --- a/src/commands/install_plugin.yml +++ b/src/commands/install_plugin.yml @@ -1,4 +1,5 @@ description: Install Redmine plugin << parameters.redmine_plugin_repository >> + parameters: redmine_plugin_repository: description: repository of Redmine plugin @@ -6,10 +7,24 @@ parameters: branch: description: branch of Redmine plugin type: string - default: master + default: '' + checkout-circle-branch: + description: "checkout $CIRCLE_BRANCH (default: true)" + type: boolean + default: true + steps: - run: name: Install plugin << parameters.redmine_plugin_repository >> working_directory: plugins command: | - git clone --depth 1 --branch << parameters.branch >> << parameters.redmine_plugin_repository >> + branch="<< parameters.branch >>" + if [ -z "$branch" ]; then + branch='master' + <<# parameters.checkout-circle-branch >> + if [ -n "$(git ls-remote -h << parameters.redmine_plugin_repository >> $CIRCLE_BRANCH)" ]; then + branch=$CIRCLE_BRANCH + fi + <> + fi + git clone --depth 1 --branch $branch << parameters.redmine_plugin_repository >>