Checkout new branch if create_branch input is true
This commit is contained in:
parent
6f7d3396b1
commit
980a8f8f16
|
@ -48,20 +48,27 @@ _switch_to_branch() {
|
||||||
echo "INPUT_BRANCH value: $INPUT_BRANCH";
|
echo "INPUT_BRANCH value: $INPUT_BRANCH";
|
||||||
|
|
||||||
# Fetch remote to make sure that repo can be switched to the right branch.
|
# Fetch remote to make sure that repo can be switched to the right branch.
|
||||||
|
|
||||||
if "$INPUT_SKIP_FETCH"; then
|
if "$INPUT_SKIP_FETCH"; then
|
||||||
echo "::debug::git-fetch has not been executed";
|
echo "::debug::git-fetch has not been executed";
|
||||||
else
|
else
|
||||||
git fetch --depth=1;
|
git fetch --depth=1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If `skip_checkout`-input is true, skip the entire checkout step.
|
||||||
if "$INPUT_SKIP_CHECKOUT"; then
|
if "$INPUT_SKIP_CHECKOUT"; then
|
||||||
echo "::debug::git-checkout has not been executed";
|
echo "::debug::git-checkout has not been executed";
|
||||||
else
|
else
|
||||||
|
|
||||||
|
# Create new local branch if `create_branch` input is true
|
||||||
|
if "$INPUT_CREATE_BRANCH"; then
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
git checkout -B $INPUT_BRANCH --;
|
||||||
|
else
|
||||||
# Switch to branch from current Workflow run
|
# Switch to branch from current Workflow run
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
git checkout $INPUT_BRANCH --;
|
git checkout $INPUT_BRANCH --;
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_add_files() {
|
_add_files() {
|
||||||
|
|
Loading…
Reference in New Issue