Skip to content

Commit 5f957c5

Browse files
committed
feat: Improve MR runner download process
This commit modifies the `mr.bash` script to improve the MR runner download process. It adds the ability to use the GitHub token when fetching releases, which is specified in the `MR_GITHUB_PAT` environment variable. This change ensures that the latest version number is fetched successfully and handles potential rate limit issues.
1 parent 44ef6d8 commit 5f957c5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mr.bash

+5-2
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,13 @@ function mr::downloadRunner {
205205

206206
if [[ -z "$url" ]]; then
207207
run::exists jq || return $?
208+
curlArgs=(-Lsm 3 --retry 1)
209+
# https://github.com/vbem/multi-runners/pull/16
210+
[[ -n "$MR_GITHUB_PAT" ]] && curlArgs+=('-H' "Authorization: Bearer ${MR_GITHUB_PAT}")
208211
url="$(
209-
run::logFailed curl -Lsm 3 --retry 1 -H "Authorization: Bearer ${MR_GITHUB_PAT}" https://api.github.com/repos/actions/runner/releases/latest \
212+
curl "${curlArgs[@]}" https://api.github.com/repos/actions/runner/releases/latest \
210213
| jq -Mcre '.assets[].browser_download_url|select(test("linux-x64-[^-]+\\.tar\\.gz"))'
211-
)" || return $?
214+
)" || log::failed $? "Fetching latest version number failed, check PAT or rate limit!" || return $?
212215
fi
213216

214217
tarpath="/tmp/$(run::logFailed basename "$url")" || return $?

0 commit comments

Comments
 (0)