fix(ci): follow HTTP redirect and validate JSON in fetch-releases step
Some checks failed
CI / Backend (push) Successful in 26s
Release / Test backend (push) Successful in 42s
Release / Check ui (push) Successful in 28s
CI / UI (push) Successful in 1m4s
CI / UI (pull_request) Failing after 11s
CI / Backend (pull_request) Successful in 27s
Release / Docker / caddy (push) Successful in 1m3s
Release / Docker / runner (push) Failing after 1m3s
Release / Docker / ui (push) Successful in 1m53s
Release / Docker / backend (push) Failing after 4m2s
Release / Gitea Release (push) Has been skipped
Some checks failed
CI / Backend (push) Successful in 26s
Release / Test backend (push) Successful in 42s
Release / Check ui (push) Successful in 28s
CI / UI (push) Successful in 1m4s
CI / UI (pull_request) Failing after 11s
CI / Backend (pull_request) Successful in 27s
Release / Docker / caddy (push) Successful in 1m3s
Release / Docker / runner (push) Failing after 1m3s
Release / Docker / ui (push) Successful in 1m53s
Release / Docker / backend (push) Failing after 4m2s
Release / Gitea Release (push) Has been skipped
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.
This commit is contained in:
@@ -192,11 +192,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Fetch releases from Gitea API
|
- name: Fetch releases from Gitea API
|
||||||
run: |
|
run: |
|
||||||
curl -sf \
|
set -euo pipefail
|
||||||
|
RESPONSE=$(curl -sfL \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
"http://gitea.kalekber.cc/api/v1/repos/kamil/libnovel/releases?limit=50&page=1" \
|
"http://gitea.kalekber.cc/api/v1/repos/kamil/libnovel/releases?limit=50&page=1")
|
||||||
-o ui/static/releases.json
|
# Validate JSON before writing — fails hard if response is not a JSON array
|
||||||
echo "Fetched $(jq length ui/static/releases.json) releases"
|
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
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user