GitHub Action Runners
I've been doing a lot of learning around GitHub Actions lately. And being the techie that I am I have spent some time in the documentation understanding how they work under the covers and it was really interesting reading about the runners that GitHub Actions use.
What is a GitHub Actions Runner?
A GitHub Actions runner is the virtual server or environment that runs the job and steps that are specified within a GitHub Actions workflow.
You can either use the built in runners or specific a self-hosted runner.
GitHub hosted GitHub Action Runners
GitHub hosted runners are either Linux, or Windows virtual machines that are hosted in Microsoft Azure. They are typically using the Standard_DS2_v2 virtual machine size. The macOS runners are hosted in GitHub's own macOS Cloud.
The benefit of using the GitHub hosted runners is you don't have to take care of the infrastructure or patching of the operating system. That is all taken care of for you.
Self-hosted GitHub Action Runners
You can run your own runners if you have a need to control that side of things. The one word of advice or warning that GitHub place here is that if you are using self-hosted runners only configure them on your Private repositories.
If you run a self-hosted runner on a public runner there is a chance that someone could run malicious code on that machine with a pull request. So it's something to bear in mind when using a self hosted runner.
Configuring your own GitHub Action Runner is a straight forward process. You can find more information if you click on Settings > Actions and then Runners from within one of your repositories.
The process is:
- Build your self-hosted runner, such as a Windows or Linux or macOS server/machine.
- Install the GitHub Actions software and follow the configuration steps.
- Start to use it in your workflows!
To use your self-hosted runner in your GitHub Actions workflow you need to use the following code:
runs-on: self-hosted
Below is one of my private repositories and I have a self-hosted runner configured to pick up any actions that are run there: