How to host your own GitHub runner on on a Virtual Instance

GitHub Runners - Overview

GitHub Actions is a flexible tool that makes it easy to automate all your software workflows. It provides you with an integrated CI/CD that automates nearly anything related to your repository.

GitHub provides a limited range of free resources to build your applications through GitHub Actions and professional developers can reach their limits quickly. Besides, teams working on professional projects tend to prefer having full control over their build environment. GitHub provides the possibility to execute runners on self-managed compute instances. A runner is an application that runs a job from a GitHub Actions workflow.

In this tutorial, you will learn how to set up a GitHub Actions runner on a Scaleway Elements Virtual Instance to automatize the workflow of your projects. For demanding workloads and best performances, the use of General Purpose instances is recommended.


You have:

Adding a workflow to your repository

1 . Log into your GitHub account and select the repository in which you want to add GitHub Actions.

2 . Click the Actions tab in your repository. A list of available workflows for your project displays.

3 . Select the workflow that corresponds to your project and click Set up this workflow. You can either create a workflow from scratch or use one of the templates suggested.

4 . Edit the workflow towards your requirements. For more information about GitHub Actions, refer to the product documentation. Once configured, save the workflow.

Installing a GitHub runner

1 . Log into your Virtual Instance using SSH

2 . Create a user for the GitHub runner:

adduser ghrunner

3 . Add the user to the superuser file:

adduser ghrunner sudo

4 . Switch into the ghrunner user account

su ghrunner

5 . Download and unpack the GitHub runner using the following commands:

# Create a folder
mkdir actions-runner && cd actions-runner
# Download the latest runner package
curl -o actions-runner-linux-x64-2.278.0.tar.gz -L
# Extract the installer
tar xzf ./actions-runner-linux-x64-2.278.0.tar.gz

Adding the runner to your GitHub repository

1 . Go back to your GitHub repository and click the Settings tab. Then click Actions in the side menu.

2 . Click Runners in the Actions section of the side menu. The external runners overview page displays.

3 . Click Add runner.

4 . The runners configuration instruction displays. Select the OS type of your OS (Linux, X64) and scroll down to Configure section of the page.

5 . Copy the configuration information displayed and execute the on your virtual instance:


Note: if you run the script without flags, you must provide the repository URL and token during the configuration.

6 . The configuration tool connects to GitHub using the given token. During the runner configuration, enter the name of the runner. It gets automatically several tags attached to it, optinally you can enter custom tags. When prompted, enter the work directory of the runner. You can confirm the default values by pressing enter. Otherwise enter your customized values before pressing enter.

7 . The runner is configured. Once everything is ready, the following message displays:

√ Runner successfully added
√ Runner connection is good
√ Settings Saved.

8 . Launch the runner using the following command:


Your self-hosted GitHub runner is now ready and you can check its status from the Runners section of your GitHub repository:

To run your CI/CD tasks on your self-hosted runner, add this YAML in your workflow file for each job:

runs-on: self-hosted

For more information about GitHub runners, refer to the official documentation.

Discover the Cloud That Makes Sense