Skip to content

Repository files navigation

Github Runner Fallback Action

javscript-action status

Github action to determine the availability of self-hosted runners, and fallback to a GitHub runner if the primary runners are offline.

This action uses GitHub API to check the statuses of self hosted-runners that match specific labels, and outputs the runner label(s), or a fallback runner if the self-hosted runner(s) is unavailable.

This output can then used on the runs-on property of subsequent jobs.

Note: In order to support an array of labels for the runs-on field, the output is formatted as a JSON string and needs to be parsed using fromJson. See example usage below.

Usage

jobs:
# Job to determine-runner:
runs-on: ubuntu-latestoutputs:
runner: ${{ steps.set-runner.outputs.use-runner }}steps:
- name: Determine which runner to useid: set-runneruses: jimmygchen/runner-fallback-action@v1with:
primary-runner: "self-hosted,linux"fallback-runner: "ubuntu-latest"github-token: ${{ secrets.YOUR_GITHUB_TOKEN }}another-job:
needs: determine-runnerruns-on: ${{ fromJson(needs.determine-runner.outputs.runner) }}steps:
- name: Do somethingrun: echo "Doing something on ${{ needs.determine-runner.outputs.runner }}"

Credit: this action is based on the pattern described by @ianpurton on this feature request thread.

About

Github action to determine the availability of self-hosted runners

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages