Skip to content

fix(ci): authenticate GH API call when resolving latest ZM version#6

Merged
Nardo86 merged 1 commit into
masterfrom
chore/auth-zm-api-lookup
May 27, 2026
Merged

fix(ci): authenticate GH API call when resolving latest ZM version#6
Nardo86 merged 1 commit into
masterfrom
chore/auth-zm-api-lookup

Conversation

@Nardo86

@Nardo86 Nardo86 commented May 27, 2026

Copy link
Copy Markdown
Owner

What's broken

The prepare job's curl to `/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.1 was 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

  • Triggered an out-of-band `workflow_dispatch` with zm_version=1.38.2 to publish the security release immediately while this PR is in flight — that build will land on Docker Hub regardless of this fix.
  • After this PR merges, leave the next `workflow_dispatch` input empty and confirm the prepare step logs Resolved ZoneMinder version: 1.38.2 (or whatever upstream's releases/latest returns at that moment).
  • Confirm the cron run on the 1st of next month picks up new ZM versions on its own without manual intervention.

🤖 Generated with Claude Code

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>
@Nardo86
Nardo86 merged commit 885906c into master May 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant