From 0139dfdb656d1100445648adc84653ba51a1bc11 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 4 Dec 2024 23:02:01 +0900 Subject: [PATCH] Set GITHUB_TOKEN for cargo-binstall by default (#556) Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --- action.yml | 2 ++ main.sh | 3 +++ 2 files changed, 5 insertions(+) diff --git a/action.yml b/action.yml index 7767660c..e7f6b3d4 100644 --- a/action.yml +++ b/action.yml @@ -46,6 +46,7 @@ runs: INPUT_TOOL: ${{ inputs.tool }} INPUT_CHECKSUM: ${{ inputs.checksum }} INPUT_FALLBACK: ${{ inputs.fallback }} + DEFAULT_GITHUB_TOKEN: ${{ github.token }} if: runner.os != 'Windows' - run: bash --noprofile --norc "${GITHUB_ACTION_PATH:?}/main.sh" shell: bash @@ -53,4 +54,5 @@ runs: INPUT_TOOL: ${{ inputs.tool }} INPUT_CHECKSUM: ${{ inputs.checksum }} INPUT_FALLBACK: ${{ inputs.fallback }} + DEFAULT_GITHUB_TOKEN: ${{ github.token }} if: runner.os == 'Windows' diff --git a/main.sh b/main.sh index 9bcd64ad..3768bf39 100755 --- a/main.sh +++ b/main.sh @@ -826,6 +826,9 @@ if [[ ${#unsupported_tools[@]} -gt 0 ]]; then info "install-action does not support ${unsupported_tools[*]}; fallback to cargo-binstall" IFS=$'\n\t' install_cargo_binstall + if [[ -z "${GITHUB_TOKEN:-}" ]] && [[ -n "${DEFAULT_GITHUB_TOKEN:-}" ]]; then + export GITHUB_TOKEN="${DEFAULT_GITHUB_TOKEN}" + fi # By default, cargo-binstall enforce downloads over secure transports only. # As a result, http will be disabled, and it will also set # min tls version to be 1.2