Skip to content

Commit 695bf1b

Browse files
amoyrtilclaude
andcommitted
Authenticate crane release lookup to avoid rate-limit 404
The "Install crane" step queried the go-containerregistry releases API unauthenticated. On shared GitHub Actions runners this hits the 60/hr rate limit, returning JSON without `.tag_name`; `jq -r .tag_name` then yields `null`, producing a `.../download/null/...` URL that 404s and fails the build. Authenticate the request with GITHUB_TOKEN (1000/hr limit) and fail fast with a clear message if the version can't be resolved. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent a432b7a commit 695bf1b

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)