From b20cea4385c1742af047db7b566f507c577190c9 Mon Sep 17 00:00:00 2001 From: Evan Coleman <706048+evandcoleman@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:01:25 -0400 Subject: [PATCH] fix logic error (#50) --- .scripts/package.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.scripts/package.sh b/.scripts/package.sh index 44e23d9..c7bc45a 100755 --- a/.scripts/package.sh +++ b/.scripts/package.sh @@ -11,17 +11,20 @@ latest_release_number () { branch_exists () { # Check if the branch exists on the remote - git ls-remote --heads origin "$1" 2>/dev/null | grep -q "$1" || echo 0 + ret=$(git ls-remote --heads origin "$1" 2>/dev/null | grep -q "$1"; echo $?) + if [ $ret -eq 0 ]; then echo 1; else echo 0; fi } pr_exists_and_open () { # Check if the PR exists and is open on the remote - gh pr view $1 --json state | jq -r '.state' | grep -q "OPEN" || echo 0 + ret=$(gh pr view $1 --json state | jq -r '.state' | grep -q "OPEN"; echo $?) + if [ $ret -eq 0 ]; then echo 1; else echo 0; fi } is_pr_approved () { # Check if the PR needs review - gh pr view $1 --json reviewDecision | jq -r '.reviewDecision' | grep -q "APPROVED" || echo 0 + ret=$(gh pr view $1 --json reviewDecision | jq -r '.reviewDecision' | grep -q "APPROVED"; echo $?) + if [ $ret -eq 0 ]; then echo 1; else echo 0; fi } xcframework_name () {