fix: Force TARGET_BRANCH to not be dev if BASE_BRANCH is dev

This commit is contained in:
demenik
2025-12-02 18:14:35 +01:00
parent 2452d6145a
commit 8899266f88

View File

@@ -1,8 +1,10 @@
#!/usr/bin/env bash
TARGET_BRANCH=${2:-$(git rev-parse --abbrev-ref HEAD)}
if [ -n "$1" ]; then
BASE_BRANCH="$1"
else
if git show-ref --verify --quiet refs/heads/dev; then
if [ "$TARGET_BRANCH" != "dev" ] && git show-ref --verify --quiet refs/heads/dev; then
BASE_BRANCH="dev"
elif git show-ref --verify --quiet refs/heads/main; then
BASE_BRANCH="main"
@@ -14,8 +16,6 @@ else
fi
fi
TARGET_BRANCH=${2:-$(git rev-parse --abbrev-ref HEAD)}
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "Error: Not a git repository." >&2
exit 1