From 684d774f520bdfee4a48bcaddd16a666887be045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Tue, 18 Apr 2023 18:15:48 +0200 Subject: [PATCH] Update deploy.sh --- generate-runners/deploy.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/generate-runners/deploy.sh b/generate-runners/deploy.sh index 6a2e3627..b88334d3 100755 --- a/generate-runners/deploy.sh +++ b/generate-runners/deploy.sh @@ -22,9 +22,11 @@ REPO=os # ------------------------------------------------------------- # we can generate per org or per repo -REGISTRATION_URL=https://api.github.com/orgs/${ORG}/actions/runners/registration-token +REGISTRATION_URL="${ORG}" +PREFIX="orgs" if [[ -n "${OWNER}" && -n "${REPO}" ]]; then - REGISTRATION_URL=https://api.github.com/repos/${OWNER}/${REPO}/actions/runners/registration-token + REGISTRATION_URL="${OWNER}/${REPO}" + PREFIX=repos fi # download runner app @@ -41,7 +43,7 @@ do -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $GH_TOKEN"\ -H "X-GitHub-Api-Version: 2022-11-28" \ - ${REGISTRATION_URL} | jq -r .token) + https://api.github.com/${PREFIX}/${REGISTRATION_URL}/actions/runners/registration-token | jq -r .token) sudo userdel -r -f actions-runner-${i} sudo groupdel actions-runner-${i} @@ -57,7 +59,7 @@ do LABEL=$LABEL_PRIMARY fi - sudo runuser -l actions-runner-${i} -c "./config.sh --url https://github.com/${ORG} --token ${TOKEN} --labels ${LABEL} --name $NAME-${i} --unattended" + sudo runuser -l actions-runner-${i} -c "./config.sh --url https://github.com/${REGISTRATION_URL} --token ${TOKEN} --labels ${LABEL} --name $NAME-${i} --unattended" sh -c "cd /home/actions-runner-${i} ; sudo ./svc.sh install actions-runner-${i}; sudo ./svc.sh start actions-runner-${i}" done rm -rf .tmp