mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2024-11-06 02:08:05 +00:00
Create new branch if NAME is given
This commit is contained in:
parent
8056699617
commit
53438d58ce
@ -48,9 +48,40 @@ _switch_to_branch() {
|
||||
git fetch --depth=1;
|
||||
fi
|
||||
|
||||
# Switch to branch from current Workflow run
|
||||
# shellcheck disable=SC2086
|
||||
git checkout $INPUT_BRANCH;
|
||||
|
||||
|
||||
|
||||
# If INPUT_BRANCH is empty, just run `git checkout`
|
||||
if [ -z "$INPUT_BRANCH" ]
|
||||
then
|
||||
|
||||
# Switch to branch from current Workflow run
|
||||
# shellcheck disable=SC2086
|
||||
git checkout $INPUT_BRANCH;
|
||||
|
||||
else
|
||||
|
||||
# If INPUT_BRANCH is given, check if a branch already exists
|
||||
# If not create one
|
||||
|
||||
|
||||
if [ -n "$(git branch | grep $INPUT_BRANCH)" ]
|
||||
then
|
||||
|
||||
# Switch to branch from current Workflow run
|
||||
# shellcheck disable=SC2086
|
||||
git checkout $INPUT_BRANCH;
|
||||
|
||||
else
|
||||
|
||||
# Switch to branch from current Workflow run
|
||||
# shellcheck disable=SC2086
|
||||
git checkout -b $INPUT_BRANCH;
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_add_files() {
|
||||
|
Loading…
Reference in New Issue
Block a user