From 0ee9fb7263afb95069f9e98e32c3035eeea91997 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Thu, 15 Oct 2020 20:21:08 +0200 Subject: [PATCH] Add checkout_options --- action.yml | 4 ++++ entrypoint.sh | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index a4a8630..6c9bf7d 100644 --- a/action.yml +++ b/action.yml @@ -44,6 +44,10 @@ inputs: description: Push options (eg. --force) required: false default: '' + checkout_options: + description: Checkout options (eg. --branch) + required: false + default: '' skip_dirty_check: description: Skip the check if the git repository is dirty and always try to create a commit. required: false diff --git a/entrypoint.sh b/entrypoint.sh index cfe6823..0829b48 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -42,8 +42,11 @@ _switch_to_branch() { # Fetch remote to make sure that repo can be switched to the right branch. git fetch; + # shellcheck disable=SC2206 + INPUT_CHECKOUT_OPTIONS_ARRAY=( $INPUT_CHECKOUT_OPTIONS ); + # Switch to branch from current Workflow run - git checkout "$INPUT_BRANCH" --; + git checkout ${INPUT_CHECKOUT_OPTIONS:+"${INPUT_CHECKOUT_OPTIONS_ARRAY[@]}"} "$INPUT_BRANCH" --; } _add_files() {