Skip to content

Commit

Permalink
Fix error if create-target-branch-if-needed is used and the target br…
Browse files Browse the repository at this point in the history
…anch already existed
  • Loading branch information
cpina committed May 19, 2023
1 parent d63a102 commit b2e2c48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b2e2c48

Please sign in to comment.