From f3881b23ee63b07eefdb107860f03706490562a3 Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Fri, 17 Nov 2023 14:06:02 -0800 Subject: [PATCH 1/2] Use a subshell to wrap the gh command --- .github/workflows/prepare-release.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index d256e3e4b5..16826366da 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -61,10 +61,7 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} run: | - # Don't fail the step if gh fails to find the release - set +e - - release=$(gh release view v$RELEASE_VERSION --json name,isDraft) + release=$( { gh release view v$RELEASE_VERSION --json name,isDraft; } || echo "" ) if [[ -z "$release" ]]; then echo "Release v$RELEASE_VERSION does not exist. Proceeding" echo "create_draft_release=true" >> "$GITHUB_ENV" From 579e42578e2fa28a9e54f424ea6db8ba6fd9cb66 Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Fri, 17 Nov 2023 14:18:04 -0800 Subject: [PATCH 2/2] Prevent globbing and word splitting --- .github/workflows/prepare-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 16826366da..cca4edb838 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -61,7 +61,7 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} run: | - release=$( { gh release view v$RELEASE_VERSION --json name,isDraft; } || echo "" ) + release=$( { gh release view "v$RELEASE_VERSION" --json name,isDraft; } || echo "" ) if [[ -z "$release" ]]; then echo "Release v$RELEASE_VERSION does not exist. Proceeding" echo "create_draft_release=true" >> "$GITHUB_ENV"