Skip to content

Commit f472c71

Browse files
Copilotmanan19
andcommitted
Add error handling for duplicate release creation
Co-authored-by: manan19 <[email protected]>
1 parent a8ce33e commit f472c71

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/publish-to-npm.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ jobs:
3939

4040
- name: Create GitHub Release
4141
run: |
42-
gh release create "v${{ steps.package-version.outputs.version }}" \
43-
--title "v${{ steps.package-version.outputs.version }}" \
44-
--generate-notes
42+
if gh release view "v${{ steps.package-version.outputs.version }}" &> /dev/null; then
43+
echo "Release v${{ steps.package-version.outputs.version }} already exists"
44+
else
45+
gh release create "v${{ steps.package-version.outputs.version }}" \
46+
--title "v${{ steps.package-version.outputs.version }}" \
47+
--generate-notes
48+
fi
4549
env:
4650
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)