1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-24 11:19:35 +01:00

Use a github token if possible

To prevent some API limiting
This commit is contained in:
regnat 2021-09-21 15:39:50 +02:00
parent c850e982ad
commit ec42ef03a5
2 changed files with 8 additions and 2 deletions

View file

@ -7,6 +7,10 @@ CurrentNixDir=$(pwd)
CurrentRev=${GITHUB_SHA:-$(git rev-parse HEAD)}
WorkDir=$(mktemp -d)
trap 'rm -r "$WorkDir"' EXIT
GITHUB_TOKEN_OPTION=()
if [[ -n "${GITHUB_TOKEN:-}" ]]; then
GITHUB_TOKEN_OPTION=("--option" "access-tokens" "github.com=$GITHUB_TOKEN")
fi
pushd "$WorkDir"
@ -22,6 +26,8 @@ cat <<EOF > flake.nix
};
}
EOF
nix --experimental-features 'nix-command flakes' flake check
nix flake check\
--experimental-features 'nix-command flakes' \
"${GITHUB_TOKEN_OPTION[@]}"
popd