Skip to content

ci: fix GitHub API 403 rate-limit by writing access-tokens to system nix.conf - #2884

Merged
mikeland73 merged 4 commits into
mainfrom
mikeland73/ci-fix-github-rate-limit
Jun 22, 2026
Merged

ci: fix GitHub API 403 rate-limit by writing access-tokens to system nix.conf#2884
mikeland73 merged 4 commits into
mainfrom
mikeland73/ci-fix-github-rate-limit

Conversation

@mikeland73

Copy link
Copy Markdown
Collaborator

Split out from mikeland73/fix-flaky-cicd-tests (4/5).

Writes access-tokens = github.com=... to the system-wide /etc/nix/nix.conf on every platform (not just macOS) so that both the Nix client and the daemon authenticate to GitHub when resolving github: flake refs. The system config is always trusted and read by both, whereas the user's ~/.config/nix/nix.conf is only honored for trusted users and is ignored by the daemon. Also adds access-tokens to the nix-installer-actionextra-conf.

Avoids the anonymous 60-req/hr API limit surfacing as HTTP error 403 under the parallel test suite.

🤖 Generated with Claude Code

mikeland73and others added 2 commits June 21, 2026 11:07
…nix.conf
Nix resolves `github:` flake refs (e.g. the latest commit of
nixpkgs-unstable) via the GitHub API. Anonymous requests are capped at
60/hr and were quickly exhausted by the parallel test suite, surfacing as
`unable to download '.../commits/nixpkgs-unstable': HTTP error 403` and
cascading test failures.
The token was only provided via NIX_CONFIG and the user-level
~/.config/nix/nix.conf. Nix only honors `access-tokens` from those
sources when the invoking user is trusted, and the daemon does not read
user config at all. On Linux the system-wide /etc/nix/nix.conf never
received the token, so GitHub calls went out unauthenticated.
- test job: write access-tokens to /etc/nix/nix.conf on every platform
(always trusted, read by client and daemon) and restart the daemon
(systemctl on Linux, launchctl on macOS).
- test-nix-versions job: pass access-tokens through the nix-installer
extra-conf, which lands in /etc/nix/nix.conf.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CopilotAI review requested due to automatic review settings June 21, 2026 18:26

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CI workflow to reduce GitHub API 403s caused by anonymous rate limiting when Nix resolves github: flake references, by ensuring an authenticated token is available to both the Nix client and (where applicable) the Nix daemon.

Changes:

  • Write access-tokens = github.com=... to the system-wide /etc/nix/nix.conf (and restart the daemon) during the main CLI test job so daemon-backed fetches authenticate.
  • Add access-tokens to the DeterminateSystems/nix-installer-actionextra-conf in the Nix version matrix job.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread.github/workflows/cli-tests.yaml Outdated
Comment thread.github/workflows/cli-tests.yaml Outdated
mikeland73and others added 2 commits June 21, 2026 12:59
- Redirect `sudo tee -a` to /dev/null so the access-tokens line isn't
echoed into the Actions log.
- On Linux, only restart nix-daemon when the unit exists and let a real
restart failure fail the job instead of hiding it behind `|| true`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mikeland73
mikeland73 merged commit 0b427f5 into mainJun 22, 2026
20 checks passed
@mikeland73
mikeland73 deleted the mikeland73/ci-fix-github-rate-limit branch June 22, 2026 01:26
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@mikeland73