https://github.com/benjaminmichaelis/get-soonest-available-runner
https://github.com/benjaminmichaelis/get-soonest-available-runner
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/benjaminmichaelis/get-soonest-available-runner
- Owner: BenjaminMichaelis
- License: mit
- Created: 2024-02-07T18:46:38.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-26T18:08:40.000Z (about 1 year ago)
- Last Synced: 2024-10-13T15:07:05.704Z (7 months ago)
- Language: PowerShell
- Size: 109 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Get Soonest Available Runner
This action checks if a self-hosted runner is available using the Github API and if it is not, sets the depending on actions to use the alternate runner (a github hosted runner in my sample). It will first look for runners at the repo level, and if not found, automatically check at the org level.
## Usage example:
```yaml
determine-runner-integration:
name: Determine which runner to use for integration tests
runs-on: ubuntu-latest
outputs:
runner: ${{ steps.set-runner.outputs.runner }}
steps:
- name: Determine which runner to use
id: set-runner
uses: benjaminmichaelis/[email protected]
with:
primary-runner: "self-hosted"
fallback-runner: "ubuntu-latest"
# This correlates to the number of free runners that must exist when the API queries.
# Increasing this can help in case you have lots of actions querying at the same time for a race condition between the time you query the runner and when the runner actually takes the job it will execute.
min-available-runners: 2
github-token: ${{ secrets.GHTOKEN_DETERMINERUNNER }} # This token must have permissions to query the runner from your repo or organization (whichever you are looking for)test-csharp-integration:
name: Run C# Integration Tests
needs: determine-runner-integration
runs-on: ${{ needs.determine-runner-integration.outputs.runner }}
...
```