fix(ci): the badge links to the public Gitea address (the runner's own server URL is http://server:3000)
Sync git.upriser.nl mirror / sync (push) Skipped

This commit is contained in:
theupriser committed 2026-09-30 13:30:36 +02:00
1 parent dac15ff9e4
commit 63b2bb96a0
1 file changed
+6 -2
+6 -2
View File
@@ -228,11 +228,15 @@ jobs:
run="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" run="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
api="https://api.github.com/repos/theupriser/steamify-cachyos-live-iso/releases" api="https://api.github.com/repos/theupriser/steamify-cachyos-live-iso/releases"
curl -fsS -H "Authorization: Bearer $GH_TOKEN" "$api/tags/$tag" -o /tmp/rel.json || { echo "::warning::no GitHub release for $tag"; exit 0; } curl -fsS -H "Authorization: Bearer $GH_TOKEN" "$api/tags/$tag" -o /tmp/rel.json || { echo "::warning::no GitHub release for $tag"; exit 0; }
ST="$st" COL="$col" RUN="$run" python3 - << 'PY' ST="$st" COL="$col" RUN="$run" RUN_ID="${{ github.run_id }}" python3 - << 'PY'
import json, os, re import json, os, re
d = json.load(open("/tmp/rel.json")) d = json.load(open("/tmp/rel.json"))
badge = f"[![ISO build](https://img.shields.io/badge/ISO_build-{os.environ['ST']}-{os.environ['COL']})]({os.environ['RUN']})"
body = d.get("body") or "" body = d.get("body") or ""
# This runner reports its internal address (http://server:3000) as the server URL: the public one is in the
# release page link that iso-1 wrote into the notes.
m = re.search(r"\]\((https?://[^)\s]+)/releases/tag/", body)
run = f"{m.group(1)}/actions/runs/{os.environ['RUN_ID']}" if m else os.environ["RUN"]
badge = f"[![ISO build](https://img.shields.io/badge/ISO_build-{os.environ['ST']}-{os.environ['COL']})]({run})"
pat = re.compile(r"\[?!\[ISO build\]\([^)]*\)(\]\([^)]*\))?") pat = re.compile(r"\[?!\[ISO build\]\([^)]*\)(\]\([^)]*\))?")
body = pat.sub(lambda m: badge, body, count=1) if pat.search(body) else badge + "\n\n" + body body = pat.sub(lambda m: badge, body, count=1) if pat.search(body) else badge + "\n\n" + body
json.dump({"body": body}, open("/tmp/patch.json", "w")) json.dump({"body": body}, open("/tmp/patch.json", "w"))