Last active
July 8, 2024 13:30
-
-
Save jonico/a94d03cac7a858e0613926d9f1bc7f2b to your computer and use it in GitHub Desktop.
Dynamic selection of GitHub Runners - as GitHub Action matrix builds currently do not allow dynamic values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
runner: ${{ steps.runner.outputs.runner }} | |
steps: | |
- id: runner | |
run: echo "::set-output name=runner::macos-latest" | |
test: | |
needs: [build] | |
runs-on: ${{ needs.build.outputs.runner }} | |
steps: | |
- run: echo I Ran |
@truonghuynguyen, I have exactly same needs, and it works for me:
runs-on: [ self-hosted, "${{ needs.build.outputs.runner }}" ]
Unfortunately, I couldn't find how to attach several runners dynamically. I didn't test but, If you have fixed number of runners, than you might try like this:
runs-on: [ self-hosted, "${{ needs.build.outputs.runner1 }}", "${{ needs.build.outputs.runner2 }}" ]
Works fine for me, thanks!! ππ
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was super helpful for a project I'm working on, thanks! π