Skip to content

Commit 16517ff

Browse files
heath-sCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent be4eeb4 commit 16517ff

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,23 @@ jobs:
6868
set -euo pipefail
6969
TAG="v${{ steps.version.outputs.version }}"
7070
ASSET="release/Stave-macOS.zip"
71-
if gh release view "$TAG" >/dev/null 2>&1; then
71+
72+
set +e
73+
RELEASE_VIEW_OUTPUT=$(gh release view "$TAG" 2>&1)
74+
RELEASE_VIEW_STATUS=$?
75+
set -e
76+
77+
if [ "$RELEASE_VIEW_STATUS" -eq 0 ]; then
7278
echo "Release $TAG already exists; updating asset."
7379
gh release upload "$TAG" "$ASSET" --clobber
74-
else
80+
elif printf '%s\n' "$RELEASE_VIEW_OUTPUT" | grep -Eqi '404|release not found'; then
7581
echo "Creating release $TAG."
7682
gh release create "$TAG" \
7783
--title "$TAG" \
7884
--generate-notes \
7985
"$ASSET"
86+
else
87+
echo "Failed to query release $TAG with gh:" >&2
88+
printf '%s\n' "$RELEASE_VIEW_OUTPUT" >&2
89+
exit "$RELEASE_VIEW_STATUS"
8090
fi

0 commit comments

Comments
 (0)