Identify which runner action is running on

Hello,

We are using github actions self hosted (orgnization) runners for many workflows now.
We have built a custom AMI based on ubuntu18 and we are running runner as root. But many times many workflows fail with permission issues (and even unknown issues but around permissions generally after we debug).

Is there any way to know which runner host is the current actions/workflow is running?
I know we can tag the runner host and then update the workflow but we have multiple runners and changing everytime is troublesome.

Thanks.

Other users also asked about exposing information like the runs-on value, but this isn’t available AFAIK (also see Fetching Runner and Environment data while an action is executing - #2 by Simran-B). If all you need is the operating system name, then you can use the RUNNER_OS env var:

The operating system of the runner executing the job. Possible values are Linux , Windows , or macOS.

Environment variables - GitHub Docs

I also found an undocumented env var ImageOS, that might be helpful.