Skip to content

Commit 2b59ac3

Browse files
authored
Merge pull request #20 from amoyrtil/fix/crane-install-rate-limit
Authenticate crane release lookup to avoid rate-limit 404
2 parents a432b7a + 695bf1b commit 2b59ac3

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,19 @@ jobs:
148148
149149
- name: Install crane
150150
if: steps.check-talos.outputs.exists == 'false'
151+
env:
152+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151153
run: |
152-
VERSION=$(curl -s https://api.github.com/repos/google/go-containerregistry/releases/latest | jq -r .tag_name)
154+
# Authenticate the API call: unauthenticated requests from shared
155+
# Actions runners hit the 60/hr rate limit and return JSON without
156+
# .tag_name, leaving VERSION=null and a 404 download URL.
157+
VERSION=$(curl -fsSL -H "Authorization: Bearer ${GH_TOKEN}" \
158+
https://api.github.com/repos/google/go-containerregistry/releases/latest | jq -r .tag_name)
159+
if [ -z "${VERSION}" ] || [ "${VERSION}" = "null" ]; then
160+
echo "Failed to resolve latest crane version" >&2
161+
exit 1
162+
fi
163+
echo "Installing crane ${VERSION}"
153164
curl -fsSL "https://github.com/google/go-containerregistry/releases/download/${VERSION}/go-containerregistry_Linux_x86_64.tar.gz" | sudo tar -xz -C /usr/local/bin crane
154165
155166
- name: Start local registry

0 commit comments

Comments
 (0)