Skip to content

Commit dc33a21

Browse files
authored
Merge pull request #200 from cachix/fix/196
fix: don't use the default GitHub token for Enterprise
2 parents 2b90cd3 + 97a1be3 commit dc33a21

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

install-nix.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,18 @@ if [[ $OSTYPE =~ darwin ]]; then
3636
fi
3737
# Allow binary caches for user
3838
add_config "trusted-users = root ${USER:-}"
39-
# Add github access token
39+
# Add a GitHub access token.
40+
# Token-less access is subject to lower rate limits.
4041
if [[ -n "${INPUT_GITHUB_ACCESS_TOKEN:-}" ]]; then
42+
echo "::debug::Using the provided github_access_token for github.com"
4143
add_config "access-tokens = github.com=$INPUT_GITHUB_ACCESS_TOKEN"
42-
elif [[ -n "${GITHUB_TOKEN:-}" ]]; then
44+
# Use the default GitHub token if available.
45+
# Skip this step if running an Enterprise instance. The default token there does not work for github.com.
46+
elif [[ -n "${GITHUB_TOKEN:-}" && $GITHUB_SERVER_URL == "https://github.com" ]]; then
47+
echo "::debug::Using the default GITHUB_TOKEN for github.com"
4348
add_config "access-tokens = github.com=$GITHUB_TOKEN"
49+
else
50+
echo "::debug::Continuing without a GitHub access token"
4451
fi
4552
# Append extra nix configuration if provided
4653
if [[ -n "${INPUT_EXTRA_NIX_CONFIG:-}" ]]; then

0 commit comments

Comments
 (0)