Skip to content

Conversation

silvestre
Copy link
Contributor

@silvestre silvestre commented Mar 6, 2025

Issue

Fixes: #74

When running actions on self-hosted GitHub Enterprise (GHES) installations, the github.token provided is specific to the private GHES instance. This token cannot be used to access resources on github.com. While the existing configuration option disable-nix-access-token allows users to disable the usage of github.token as a Nix access token, this workaround fails once the unauthenticated rate limit for api.github.com is exceeded.

Currently, there is no mechanism to configure a custom, working Nix access token for such scenarios. This limitation creates challenges for GHES users who need to:

  • Authenticate against api.github.com without exceeding rate limits.
  • Configure Nix access tokens for other APIs, such as private hosts, when using Nix packages from private repositories.

Fix

Add a new configuration option extra-nix-config that gets appended to nix.conf if passed.

This can be used to configure access tokens, and I added this use case as an example to the README.md.

# Issue

See jetify-com#74:

When running actions on self-hosted GitHub Enterprise (GHES) installations, the `github.token` provided is specific to the private GHES instance. This token cannot be used to access resources on `github.com`. While the existing configuration option `disable-nix-access-token` allows users to disable the usage of `github.token` as a Nix access token, this workaround fails once the unauthenticated rate limit for `api.github.com` is exceeded.

Currently, there is no mechanism to configure a custom, working Nix access token for such scenarios. This limitation creates challenges for GHES users who need to:
- Authenticate against `api.github.com` without exceeding rate limits.
- Configure Nix access tokens for other APIs, such as private hosts, when using Nix packages from private repositories.

# Fix

Add a new configuration option `extra-nix-config` that gets appended to `nix.conf` if passed.

This can be used to configure access tokens, and I added this use case as an example to the README.md.
@silvestre silvestre marked this pull request as ready for review March 6, 2025 13:25
@silvestre silvestre changed the title Add extra nix config feat(action): Add extra-nix-config input for custom nix.conf settings Mar 6, 2025
- name: Configure nix access-tokens
if: inputs.disable-nix-access-token == 'false'
if: inputs.disable-nix-access-token == 'false' && github.server_url == 'https://github.com'
Copy link
Contributor Author

@silvestre silvestre Mar 6, 2025

Choose a reason for hiding this comment

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

This is more of a nice to have: If you are running this action on a GitHub Enterprise Server, configuring the github.token as nix access token to github.com makes no sense, so we can skip it, and at least make the unauthenticated access work, without requiring the user to set disable-nix-access-token.

tested using a low-risk config option
Copy link
Contributor

@LucilleH LucilleH left a comment

Choose a reason for hiding this comment

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

Thank you!

silvestre and others added 2 commits March 11, 2025 08:52
Co-authored-by: Lucille Hua <[email protected]>
Signed-off-by: Silvestre Zabala <[email protected]>
Signed-off-by: Lucille Hua <[email protected]>
@LucilleH LucilleH added this pull request to the merge queue Mar 11, 2025
Merged via the queue into jetify-com:main with commit f01e834 Mar 11, 2025
14 checks passed
Sign up for free to 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.

No ability to configure nix access tokens with specified values
2 participants