Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 -
tar -xzf "$RUNNER_TEMP/$tgz" -C "$RUNNER_TEMP" actionlint
- name: Lint workflows
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 -
tar -xzf "$RUNNER_TEMP/$tgz" -C "$RUNNER_TEMP" gitleaks

Expand Down
Loading