Expose `runs-on` labels in events related to workflows / jobs

We are running self-hosted runners in Kubernetes for our organization using summerwind/actions-runner-controller and a webhook server that looks at the github check_run events to scale up/down runners.

looking at workflow related github events, currently nothing is exposed that can be used to determine runs-on labels.

This could be very helpful in our Github Actions adoption journey.

1 Like

Agreed , this is would be very useful ! Working on a similar project that reacts to check_run events to launch runners via LXD. The associated runner labels are required to:

  • Determine if the check_run is intended for Github hosted or self-hosted runners, else we end up spawning runners when not needed.
  • If its self-hosted then we need labels to know where to route it.

I can think one way to do it through API but its not pretty:

  1. From the check_run event get the build name check_run.name and check_run.head_sha and check_run.check_suite.id
  2. Get unfinished workflow runs for the repo and search for one with matching check_suite_id. From that get the workflow_id
  3. Get workflow object and get the path
  4. Grab the workflow file for commit @head_sha
  5. Parse workflow yaml and get jobs. Find your matching job and pull out the runs-on

Not very efficient, 3 API calls just for labels. The job name is also not reliably stable. If running matrix builds the used variables are appended, easy enough to parse I guess.

If anyone knows simpler method, would love to know. Ideally labels should be inside check_run event.

Associated project: GitHub - jonans/lxdrunner: Run ephemeral self-hosted runners for GitHub Actions with LXD

1 Like