Skip to main content
In this lesson you’ll create a GitHub Actions self‑hosted runner, register it with an enterprise/shared runner group, and configure a workflow to use it. Before you begin, make sure your organization/enterprise action policies permit the necessary workflow actions and that you can generate a registration token.
A dark-themed screenshot of the GitHub Enterprise "NextGen Gaming" Policies → Actions settings page. It shows options for enabling Actions, choosing allowed action scope (enterprise or select non-enterprise), and checkboxes for allowing GitHub and Marketplace actions.

Runners vs. Runner groups

  • Runner: a machine (VM, container, or physical host) that executes CI/CD jobs for GitHub Actions.
  • Runner group: an organizational entity (organization or enterprise scoped) that groups runners and controls which repositories and workflows can use those runners.
In this lesson we’ll:
  1. Create a runner group named production-shared-group.
  2. Install and register a Linux self‑hosted runner and assign it to that group.
  3. Allow one or more repositories to use the runner group and target the runner with workflow labels.
When creating a group you can set:
  • Scope (which organizations can use the group).
  • Whether public repositories are allowed to use the group.
Registration tokens are short‑lived. Generate the registration token from the GitHub UI immediately before registering a runner — tokens typically expire quickly (often around 1 hour).
Allowing self-hosted runners for public repositories is a security risk. External contributors (including forks) could run untrusted code on your infrastructure. Do not enable public repository access for self-hosted runners unless you understand and mitigate the security risks.

Create the runner group

Create a runner group (for example, production-shared-group) at the enterprise or organization level. You can use the default group, but creating a dedicated group helps with access control, visibility, and labels organization. By default, an enterprise-shared group has no repositories allowed to use it — you must explicitly allow individual repositories or enable all repositories for that group.

Install and register a Linux self‑hosted runner

SSH into a Linux VM and perform these steps:
  • Create a directory for the runner.
  • Download the official GitHub Actions runner package (replace the version if needed).
  • Optionally validate the SHA256 checksum.
  • Extract, configure (register) using the registration token, then run the runner.
Run these example commands, replacing v2.336.0 and the download URL if you need a newer version. Replace <RUNNER_TOKEN> with the registration token you obtained from GitHub.
During ./config.sh you’ll be prompted for:
  • Runner group (press Enter for Default, or type production-shared-group).
  • Runner name (for example, prod-linux).
  • Additional labels (default: self-hosted, Linux, X64; you can add custom labels like prod-ubuntu).
  • Work folder (press Enter to accept _work).
Sample interactive registration output:
After configuration, start the runner with ./run.sh. Example output indicating the runner is connected and listening:

Assign repository access to the runner group

At the organization level you can view enterprise-shared runner groups (e.g., production-shared-group). From the runner group settings you must explicitly allow repositories to use the group — either select specific repositories (recommended) or allow all repositories. Select the repository (for example ghks-gadrills-demo) to grant access to production-shared-group. If you want this group to serve multiple repositories, enable those repositories here.
A screenshot of a GitHub organization settings page for "game-devstudio" showing the "Runner groups" section with a Default group and a production-shared-group listed. The dark-mode UI shows runner counts (0 for Default, 1 for production-shared-group) and the left-hand settings menu.

Target the runner from a workflow

Runners advertise labels that workflows use to select execution targets. Default labels: self-hosted, Linux, X64. Add custom labels during configuration (for example, prod-ubuntu) to target specific hardware or environments. Example workflow that runs on the self‑hosted runner using the custom label prod-ubuntu:
After committing this workflow to the repository, the registered runner (e.g., prod-linux) will pick up matching jobs. The runner process will show job lifecycle messages:
On GitHub Actions job details you’ll see setup lines including the runner name, group, and machine:
A dark-mode GitHub organization settings page for "game-devstudio" open to the Runners section. It shows a self-hosted runner named "prod-linux" in the "production-shared-group" with status "Idle" and a "New runner" button.

Quick reference

Note: Wrap any tokens or placeholders like <RUNNER_TOKEN> in backticks when copying commands.

Summary

  • Use runner groups to control which repositories and workflows can access self‑hosted runners.
  • Install and register a self‑hosted runner on a VM using the official runner package and a short‑lived registration token.
  • Use labels (default and custom) in your workflow runs-on to target specific runners.
  • Never enable self‑hosted runners for public repositories without a clear mitigation strategy.

Watch Video