From bd38439acb6f55c063b9c7d43dcd2b44111ef922 Mon Sep 17 00:00:00 2001 From: pb <5535435+pekth@users.noreply.github.com> Date: Mon, 9 Nov 2026 01:22:08 -0500 Subject: [PATCH 1/2] ci: retry release downloads and fall back to the API asset URL GitHub's release download URL returns 504 for long stretches while the API asset URL for the same file works. Plain curl -sSL saved the error body, so the gitleaks sha256 check failed in intersects' Security run. Each sha256 check is unchanged. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/actionlint.yml | 10 +++++++++- .github/workflows/security.yml | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 826afbd..77e5cc5 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -30,7 +30,15 @@ jobs: run: | set -euo pipefail tgz="actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" - curl -sSLo "$RUNNER_TEMP/$tgz" "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/$tgz" + # The release download URL can return 504 for hours while the API asset URL + # for the same file still works, so retry, then fall back to that. + get() { curl --fail --silent --show-error --location --retry 3 --retry-all-errors --retry-delay 5 "$@"; } + if ! get -o "$RUNNER_TEMP/$tgz" "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/$tgz"; then + echo "Release download failed for $tgz; trying the API asset URL" >&2 + url="$(get "https://api.github.com/repos/rhysd/actionlint/releases/tags/v${ACTIONLINT_VERSION}" | + python3 -c 'import json, sys; print(next(a["url"] for a in json.load(sys.stdin)["assets"] if a["name"] == sys.argv[1]))' "$tgz")" + get -H 'Accept: application/octet-stream' -o "$RUNNER_TEMP/$tgz" "$url" + fi echo "${ACTIONLINT_SHA256} $RUNNER_TEMP/$tgz" | sha256sum -c - tar -xzf "$RUNNER_TEMP/$tgz" -C "$RUNNER_TEMP" actionlint - name: Lint workflows diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 72d9425..a54469c 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -58,7 +58,15 @@ jobs: run: | set -euo pipefail tgz="gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" - curl -sSLo "$RUNNER_TEMP/$tgz" "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/$tgz" + # The release download URL can return 504 for hours while the API asset URL + # for the same file still works, so retry, then fall back to that. + get() { curl --fail --silent --show-error --location --retry 3 --retry-all-errors --retry-delay 5 "$@"; } + if ! get -o "$RUNNER_TEMP/$tgz" "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/$tgz"; then + echo "Release download failed for $tgz; trying the API asset URL" >&2 + url="$(get "https://api.github.com/repos/gitleaks/gitleaks/releases/tags/v${GITLEAKS_VERSION}" | + python3 -c 'import json, sys; print(next(a["url"] for a in json.load(sys.stdin)["assets"] if a["name"] == sys.argv[1]))' "$tgz")" + get -H 'Accept: application/octet-stream' -o "$RUNNER_TEMP/$tgz" "$url" + fi echo "${GITLEAKS_SHA256} $RUNNER_TEMP/$tgz" | sha256sum -c - tar -xzf "$RUNNER_TEMP/$tgz" -C "$RUNNER_TEMP" gitleaks From 0635a7611cef58a78676a0f69f152fbebccdd1fe Mon Sep 17 00:00:00 2001 From: pb <5535435+pekth@users.noreply.github.com> Date: Mon, 9 Nov 2026 01:28:47 -0500 Subject: [PATCH 2/2] ci: parse the release JSON from a file, not a retried pipe Co-Authored-By: Claude Opus 5.5 --- .github/workflows/actionlint.yml | 4 ++-- .github/workflows/security.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 77e5cc5..ab32d7d 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -35,8 +35,8 @@ jobs: get() { curl --fail --silent --show-error --location --retry 3 --retry-all-errors --retry-delay 5 "$@"; } if ! get -o "$RUNNER_TEMP/$tgz" "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/$tgz"; then echo "Release download failed for $tgz; trying the API asset URL" >&2 - url="$(get "https://api.github.com/repos/rhysd/actionlint/releases/tags/v${ACTIONLINT_VERSION}" | - python3 -c 'import json, sys; print(next(a["url"] for a in json.load(sys.stdin)["assets"] if a["name"] == sys.argv[1]))' "$tgz")" + get -o "$RUNNER_TEMP/release.json" "https://api.github.com/repos/rhysd/actionlint/releases/tags/v${ACTIONLINT_VERSION}" + url="$(python3 -c 'import json, sys; print(next(a["url"] for a in json.load(sys.stdin)["assets"] if a["name"] == sys.argv[1]))' "$tgz" < "$RUNNER_TEMP/release.json")" get -H 'Accept: application/octet-stream' -o "$RUNNER_TEMP/$tgz" "$url" fi echo "${ACTIONLINT_SHA256} $RUNNER_TEMP/$tgz" | sha256sum -c - diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index a54469c..3b445d4 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -63,8 +63,8 @@ jobs: get() { curl --fail --silent --show-error --location --retry 3 --retry-all-errors --retry-delay 5 "$@"; } if ! get -o "$RUNNER_TEMP/$tgz" "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/$tgz"; then echo "Release download failed for $tgz; trying the API asset URL" >&2 - url="$(get "https://api.github.com/repos/gitleaks/gitleaks/releases/tags/v${GITLEAKS_VERSION}" | - python3 -c 'import json, sys; print(next(a["url"] for a in json.load(sys.stdin)["assets"] if a["name"] == sys.argv[1]))' "$tgz")" + get -o "$RUNNER_TEMP/release.json" "https://api.github.com/repos/gitleaks/gitleaks/releases/tags/v${GITLEAKS_VERSION}" + url="$(python3 -c 'import json, sys; print(next(a["url"] for a in json.load(sys.stdin)["assets"] if a["name"] == sys.argv[1]))' "$tgz" < "$RUNNER_TEMP/release.json")" get -H 'Accept: application/octet-stream' -o "$RUNNER_TEMP/$tgz" "$url" fi echo "${GITLEAKS_SHA256} $RUNNER_TEMP/$tgz" | sha256sum -c -