From 6a76e97a671edf1cf55833c4373599f28f63d385 Mon Sep 17 00:00:00 2001 From: Admin Date: Sat, 28 Mar 2026 22:38:09 +0500 Subject: [PATCH] fix(ci): follow HTTP redirect and validate JSON in fetch-releases step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit curl -sf without -L silently wrote '301 Moved Permanently' to releases.json instead of following the http→https redirect. Added -L to follow redirects, set -euo pipefail, and jq type validation so the step fails hard on bad JSON. --- .gitea/workflows/release.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index f95db5e..d785299 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -192,11 +192,14 @@ jobs: - name: Fetch releases from Gitea API run: | - curl -sf \ + set -euo pipefail + RESPONSE=$(curl -sfL \ -H "Accept: application/json" \ - "http://gitea.kalekber.cc/api/v1/repos/kamil/libnovel/releases?limit=50&page=1" \ - -o ui/static/releases.json - echo "Fetched $(jq length ui/static/releases.json) releases" + "http://gitea.kalekber.cc/api/v1/repos/kamil/libnovel/releases?limit=50&page=1") + # Validate JSON before writing — fails hard if response is not a JSON array + COUNT=$(echo "$RESPONSE" | jq 'if type == "array" then length else error("expected array, got \(type)") end') + echo "$RESPONSE" > ui/static/releases.json + echo "Fetched $COUNT releases" - uses: docker/setup-buildx-action@v3