Skip to content

Commit

Permalink
feat: Improve MR runner download process
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vbem committed Aug 7, 2024
1 parent 44ef6d8 commit 5f957c5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mr.bash
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,13 @@ function mr::downloadRunner {

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

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

0 comments on commit 5f957c5

Please sign in to comment.