fix(ci): authenticate GH API call when resolving latest ZM version#6
Merged
Conversation
The `prepare` job's `curl` to /repos/ZoneMinder/zoneminder/releases/latest ran unauthenticated, hitting GitHub's 60 req/h-per-IP rate limit. Because hosted runners share an IP pool, that limit is regularly exhausted by other projects on the same runner — silently failing the version probe and sending the build to ZM_FALLBACK_VERSION. This is exactly what happened in run 26510066496 (1.38.2 was published ~hours earlier; our workflow saw nothing and built 1.38.1 from the fallback). Adding the default GITHUB_TOKEN as a Bearer header lifts the limit to 1000 req/h per repo, which is plenty for a once-a-month cron. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's broken
The
preparejob'scurlto `/repos/ZoneMinder/zoneminder/releases/latest` ran unauthenticated, which means it shared the GitHub API's 60 req/h-per-IP unauthenticated rate limit. Hosted runners share IPs across many jobs, so this limit is often exhausted by the time our scheduled build runs.When the API returned a 403, `curl -fsSL` swallowed the error, `jq` got nothing, and the fallback
ZM_FALLBACK_VERSION=1.38.1was used — silently rebuilding the same version forever.This caused run 26510066496 to build 1.38.1 even though 1.38.2 had been published hours earlier (a security release with multiple RCE / command-injection fixes).
Fix
Pass the default
${{ github.token }}as a Bearer header. That lifts the limit to 1000 req/h per repo — plenty for one monthly cron and a handful of manual runs.Test plan
zm_version=1.38.2to publish the security release immediately while this PR is in flight — that build will land on Docker Hub regardless of this fix.Resolved ZoneMinder version: 1.38.2(or whatever upstream'sreleases/latestreturns at that moment).🤖 Generated with Claude Code