Skip to content

Commit cf522f2

Browse files
committed
self-hosted-runners: map all inputs to environment variables
This not only helps consistency, but also makes it easier to turn the workflow into a `push`-triggered one, for testing. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent d706073 commit cf522f2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

.github/workflows/create-azure-self-hosted-runners.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ on:
2525
description: Repo to deploy the runner to. Only needed if runner_scope is set to "repo-level" (defaults to current repository)
2626

2727
env:
28+
AMOUNT_OF_RUNNERS: ${{ github.event.inputs.amount_of_runners }}
29+
ACTIONS_RUNNER_SCOPE: ${{ github.event.inputs.runner_scope }}
2830
ACTIONS_RUNNER_ORG: "${{ github.event.inputs.runner_org || github.repository_owner }}"
2931
ACTIONS_RUNNER_REPO: "${{ github.event.inputs.runner_repo || github.event.repository.name }}"
3032
# This has to be a public URL that the VM can access after creation
@@ -49,7 +51,6 @@ jobs:
4951
- name: Create matrix for setting up runners in parallel
5052
id: create-matrix
5153
run: |
52-
AMOUNT_OF_RUNNERS="${{ inputs.amount_of_runners }}"
5354
echo "Going to create $AMOUNT_OF_RUNNERS runners"
5455
MATRIX="matrix={\"runner_index\":[$(seq -s "," 1 $AMOUNT_OF_RUNNERS)]}"
5556
echo "Going to use this matrix: $MATRIX"
@@ -74,7 +75,7 @@ jobs:
7475
# https://github.com/actions/runner/issues/475
7576
- name: Generate Actions Runner token and registration URL
7677
run: |
77-
case "${{ inputs.runner_scope }}" in
78+
case "$ACTIONS_RUNNER_SCOPE" in
7879
"org-level")
7980
ACTIONS_API_URL="https://api.github.com/repos/${{ env.ACTIONS_RUNNER_ORG }}/actions/runners/registration-token"
8081
echo ACTIONS_RUNNER_REGISTRATION_URL="https://github.com/${{ env.ACTIONS_RUNNER_ORG }}" >> $GITHUB_ENV
@@ -84,7 +85,7 @@ jobs:
8485
echo ACTIONS_RUNNER_REGISTRATION_URL="https://github.com/${{ env.ACTIONS_RUNNER_ORG }}/${{ env.ACTIONS_RUNNER_REPO }}" >> $GITHUB_ENV
8586
;;
8687
*)
87-
echo "Unsupported runner scope: ${{ inputs.runner_scope }}"
88+
echo "Unsupported runner scope: $ACTIONS_RUNNER_SCOPE"
8889
exit 1
8990
;;
9091
esac

0 commit comments

Comments
 (0)