Skip to content

Detect Self-Hosted Runner or GitHub Hosted Runner in GitHub Action Workflow #48359

Answered by jsoref
PSchmiedmayer asked this question in Actions
Discussion options

You must be logged in to vote

Per @maskati https://github.com/orgs/community/discussions/48359#discussioncomment-9059557, it's now possible to detect this directly (and will hopefully be eventually documented for github/docs#32443)


Previously...

https://docs.github.com/en/actions/learn-github-actions/contexts#example-contents-of-the-runner-context

You'll probably want runner.name

The self-hosted runners should have names that don't start with GitHub Actions. (If your self-hosted runners names' start with that, you're doing something wrong, and you should fix that...)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@PSchmiedmayer
Comment options

Answer selected by PSchmiedmayer
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question
3 participants