From a4b8aaf5a24260b643f571235829e53e6b3cc920 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Sun, 5 Feb 2023 16:35:01 +0100 Subject: [PATCH] Fix rate-limits by using github.token by default Turns out there is a default github token we can use to talk to github and avoid the rate limit issues. --- action.yml | 1 + install-nix.sh | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index fe1a740..bacfe24 100644 --- a/action.yml +++ b/action.yml @@ -26,3 +26,4 @@ runs: INPUT_INSTALL_OPTIONS: ${{ inputs.install_options }} INPUT_INSTALL_URL: ${{ inputs.install_url }} INPUT_NIX_PATH: ${{ inputs.nix_path }} + GITHUB_TOKEN: ${{ github.token }} diff --git a/install-nix.sh b/install-nix.sh index 7d89eea..62539c7 100755 --- a/install-nix.sh +++ b/install-nix.sh @@ -22,8 +22,10 @@ add_config "max-jobs = auto" # Allow binary caches for user add_config "trusted-users = root $USER" # Add github access token -if [[ $INPUT_GITHUB_ACCESS_TOKEN != "" ]]; then +if [[ -n "${INPUT_GITHUB_ACCESS_TOKEN:-}" ]]; then add_config "access-tokens = github.com=$INPUT_GITHUB_ACCESS_TOKEN" +elif [[ -n "${GITHUB_TOKEN:-}" ]]; then + add_config "access-tokens = github.com=$GITHUB_TOKEN" fi # Append extra nix configuration if provided if [[ $INPUT_EXTRA_NIX_CONFIG != "" ]]; then