Use unauthenticated HTTP status check for release existence
Align with docker-flutter-sdk pattern: check release existence via HTTP status code (no auth needed), reserve GITEA_TOKEN for release creation only. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ee428c1331
commit
5f94a3caac
@ -85,13 +85,11 @@ jobs:
|
|||||||
echo "Latest Flutter stable: $LATEST"
|
echo "Latest Flutter stable: $LATEST"
|
||||||
echo "new_version=$LATEST" >> "$GITHUB_OUTPUT"
|
echo "new_version=$LATEST" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
# Check if a release with this tag already exists (use -sS, not -f, so 404 doesn't fail)
|
# Check if a release with this tag already exists (unauthenticated, HTTP status only)
|
||||||
EXISTING=$(curl -sS \
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/tags/v${LATEST}")
|
||||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/tags/v${LATEST}" \
|
|
||||||
| jq -r '.tag_name // empty')
|
|
||||||
|
|
||||||
if [ -n "$EXISTING" ]; then
|
if [ "$STATUS" = "200" ]; then
|
||||||
echo "Release v${LATEST} already exists, skipping"
|
echo "Release v${LATEST} already exists, skipping"
|
||||||
echo "has_new=false" >> "$GITHUB_OUTPUT"
|
echo "has_new=false" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user