1
0
mirror of synced 2025-12-25 02:17:36 -05:00
Files
docs/content/actions/hosting-your-own-runners/using-labels-with-self-hosted-runners.md

4.6 KiB

title, intro, versions, type, shortTitle
title intro versions type shortTitle
Using labels with self-hosted runners You can use labels to organize your self-hosted runners based on their characteristics.
fpt ghes ghae ghec
* * * *
tutorial Label runners

{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}

For information on how to use labels to route jobs to specific types of self-hosted runners, see "Using self-hosted runners in a workflow."

{% data reusables.actions.self-hosted-runner-management-permissions-required %}

Creating a custom label

{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.settings-sidebar-actions-runner-selection %}

  1. In the "Labels" section, click {% octicon "gear" aria-label="The Gear icon" %}.
  2. In the "Find or create a label" field, type the name of your new label and click Create new label. The custom label is created and assigned to the self-hosted runner. Custom labels can be removed from self-hosted runners, but they currently can't be manually deleted. {% data reusables.actions.actions-unused-labels %} {% elsif ghae or ghes < 3.4 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.self-hosted-runner-list %} {% data reusables.actions.self-hosted-runner-list-group %} {% data reusables.actions.self-hosted-runner-labels-view-assigned-labels %}
  3. In the "Filter labels" field, type the name of your new label, and click Create new label. Add runner label

The custom label is created and assigned to the self-hosted runner. Custom labels can be removed from self-hosted runners, but they currently can't be manually deleted. {% data reusables.actions.actions-unused-labels %} {% endif %}

Assigning a label to a self-hosted runner

{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.runner-label-settings %}

  1. To assign a label to your self-hosted runner, in the "Find or create a label" field, click the label. {% elsif ghae or ghes < 3.4 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.self-hosted-runner-list %} {% data reusables.actions.self-hosted-runner-list-group %} {% data reusables.actions.self-hosted-runner-labels-view-assigned-labels %}
  2. Click on a label to assign it to your self-hosted runner. {% endif %}

Removing a custom label from a self-hosted runner

{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.runner-label-settings %}

  1. In the "Find or create a label" field, assigned labels are marked with the {% octicon "check" aria-label="The Check icon" %} icon. Click on a marked label to unassign it from your self-hosted runner. {% elsif ghae or ghes < 3.4 %} {% data reusables.actions.self-hosted-runner-navigate-to-repo-org-enterprise %} {% data reusables.actions.self-hosted-runner-list %} {% data reusables.actions.self-hosted-runner-list-group %} {% data reusables.actions.self-hosted-runner-labels-view-assigned-labels %}
  2. Click on the assigned label to remove it from your self-hosted runner. {% data reusables.actions.actions-unused-labels %} {% endif %}

Using the configuration script to create and assign labels

You can use the configuration script on the self-hosted runner to create and assign custom labels. For example, this command assigns a label named gpu to the self-hosted runner.

./config.sh --labels gpu

The label is created if it does not already exist. You can also use this approach to assign the default labels to runners, such as x64 or linux. When default labels are assigned using the configuration script, {% data variables.product.prodname_actions %} accepts them as given and does not validate that the runner is actually using that operating system or architecture.

You can use comma separation to assign multiple labels. For example:

./config.sh --labels gpu,x64,linux

{% note %}

** Note:** If you replace an existing runner, then you must reassign any custom labels.

{% endnote %}