From 44c07826a739e00d0263a18339a10018f9df404d Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper Date: Sun, 12 Feb 2023 10:50:11 +0100 Subject: [PATCH] Fix order of executions to preserve return code --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 63329f3..cc72d2f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -169,9 +169,9 @@ if [[ -z "${PR_NUMBER}" ]]; then COMMAND="hub pull-request -b ${TARGET_BRANCH} -h ${SOURCE_BRANCH} --no-edit ${ARG_LIST[@]}" echo -e "\nRunning: ${COMMAND}" URL=$(sh -c "${COMMAND}") - PR_NUMBER=$(gh pr view --json number -q .number ${URL}) # shellcheck disable=SC2181 if [[ "$?" != "0" ]]; then RET_CODE=1; fi + PR_NUMBER=$(gh pr view --json number -q .number "${URL}") else echo -e "\nUpdating pull request" COMMAND="hub api --method PATCH repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER} --field 'body=@/tmp/template'"