Actions API: get "runs-on" value of a job

Hi everybody!

We are using different types of self-hosted runners in our project.

In order to monitor and orchestrate the state of our dev infrastructure, I am trying to find a way to identify the value of the runs-on attribute of all queued jobs, but I fail to find a way.

Am I missing something, or is something like this not provided (yet)?

Hi @gierdo,

Glad to see you in Github Community Forum!

run-on attribute is not provided in workflow. You can try to check the runner hostname instead(especially when you use hostname as the runner label).

And if you use matrix value as the run-on value, you can check matrix value instead. For example:

  job1:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [label1, label2]

You can echo ${{ matrix.os }} in job, it’s same as runner label used in the run.

Thanks

Hi @weide-zhou!

Thank you for your quick response and support!
Sadly, I must have failed to describe my intent clearly.

I am trying to create a custom typescript action which consumes the GitHub API with Octokit. In the action I would like to check how many jobs are queued for the different runner types.

Hi @gierdo,

Thanks for your reply!

run-on attribute is not provided in Github API with Octokit. It’s only supported to list runners of a repo/oganization, not for workflow.
I’m afraid it’s not support to check the queue job number for different runner types.