mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2024-12-21 23:56:09 -07:00
Fix error if create-target-branch-if-needed is used and the target branch already existed
This commit is contained in:
parent
d63a102c8f
commit
b2e2c48ca5
|
@ -149,7 +149,11 @@ git config --global --add safe.directory "$CLONE_DIR"
|
|||
if [ "$CREATE_TARGET_BRANCH_IF_NEEDED" = "true" ]
|
||||
then
|
||||
echo "[+] Switch to the TARGET_BRANCH"
|
||||
git switch -c "$TARGET_BRANCH"
|
||||
# || true: if the $TARGET_BRANCH already existed in the destination repo:
|
||||
# it is already the current branch and it cannot be switched to
|
||||
# (it's not needed)
|
||||
# If the branch did not exist: it switches (creating) the branch
|
||||
git switch -c "$TARGET_BRANCH" || true
|
||||
fi
|
||||
|
||||
echo "[+] Adding git commit"
|
||||
|
|
Loading…
Reference in New Issue
Block a user