Skip to content

Commit aea8920

Browse files
committed
fix(release): ghost guard also verifies the GitHub Release exists
1 parent e112e9c commit aea8920

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/release-please.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ jobs:
210210
211211
- name: Verify release commit produced a tag (ghost-release guard)
212212
if: github.ref == 'refs/heads/main'
213+
env:
214+
GH_TOKEN: ${{ github.token }}
213215
run: |
214216
# `github-release` exits 0 even when it finds nothing to release ([]).
215217
# If the commit that triggered this run is a merged `release: X.Y.Z`
@@ -223,7 +225,11 @@ jobs:
223225
exit 0
224226
fi
225227
if git ls-remote --exit-code --tags origin "v$VER" >/dev/null 2>&1; then
226-
echo "Tag v$VER exists - release verified"
228+
if ! gh api "repos/${{ github.repository }}/releases/tags/v$VER" >/dev/null 2>&1; then
229+
echo "::error::Tag v$VER exists but there is no GitHub Release for it - the publish workflow (release: published) will never fire. Create it: gh release create v$VER --generate-notes"
230+
exit 1
231+
fi
232+
echo "Tag v$VER and its GitHub Release exist - release verified"
227233
else
228234
echo "::error::Merged release commit for $VER but no v$VER tag exists. github-release silently no-opped (merged release PR likely missing the autorelease pending label). Add the label to the merged PR and re-run this workflow."
229235
exit 1

0 commit comments

Comments
 (0)