注意
GitHub Enterprise Server 目前不支持 GitHub 托管的运行器。 可以在 GitHub public roadmap 上查看有关未来支持计划的更多信息。
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. You can also route jobs to runners in a specific group. For more information, see Choosing the runner for a job.
自托管运行器可位于存储库、组织或 GitHub Enterprise Server 上的企业设置中。 要管理自托管运行器,您必须拥有以下权限,具体取决于添加自托管运行器的位置:
-
用户存储库:你必须是存储库所有者。
-
组织:你必须是组织所有者。
-
组织存储库:你必须是组织所有者,或者拥有对存储库的管理员访问权限。
-
企业:你必须是 GitHub Enterprise 站点管理员。
注意
Actions Runner Controller does not support multiple labels, to find out more please read our Actions Runner Controller documentation
Creating a custom label
You can create custom labels for runners at the repository, organization, and enterprise levels.
- Creating a custom label for a repository runner
- Creating a custom label for an organization runner
- Creating a custom label for an enterprise runner
注意
Labels are case-insensitive.
Creating a custom label for a repository runner
- 导航到已注册自托管运行器组的存储库的主页。
- 单击“ Settings”****。
- 在左侧边栏中,单击 “操作”,然后单击“运行器” 。
- 在运行器列表中,单击要配置的运行器的名称。
- 在“Labels(标签)”部分,单击 。
- 在“查找或创建标签”字段中,键入新标签的名称,然后单击“创建新标签”。 将创建自定义标签并分配给自托管运行器。 可以从自托管的运行器中删除自定义标签,但当前无法手动删除。 未分配给运行器的任何未使用标签将在 24 小时内被自动删除。
Creating a custom label for an organization runner
- 导航到已注册自托管运行器组的组织的主页。
- 单击“ Settings”****。
- 在左侧边栏中,单击 “操作”,然后单击“运行器” 。
- 在运行器列表中,单击要配置的运行器的名称。
- 在“Labels(标签)”部分,单击 。
- 在“查找或创建标签”字段中,键入新标签的名称,然后单击“创建新标签”。 将创建自定义标签并分配给自托管运行器。 可以从自托管的运行器中删除自定义标签,但当前无法手动删除。 未分配给运行器的任何未使用标签将在 24 小时内被自动删除。
Creating a custom label for an enterprise runner
-
在 的右上角,单击你的个人资料照片,然后单击“企业设置”****。
-
在页面左侧的企业帐户边栏中,单击“ Policies”****
-
在“ 策略”下,单击“操作”。****
-
单击“运行器”选项卡。
-
在运行器列表中,单击要配置的运行器的名称。
-
在“Labels(标签)”部分,单击 。
-
在“查找或创建标签”字段中,键入新标签的名称,然后单击“创建新标签”。 将创建自定义标签并分配给自托管运行器。 可以从自托管的运行器中删除自定义标签,但当前无法手动删除。 未分配给运行器的任何未使用标签将在 24 小时内被自动删除。
Assigning a label to a self-hosted runner
You can assign labels to self-hosted runners at the repository, organization, and enterprise levels.
- Assigning a label to a repository runner
- Assigning a label to an organization runner
- Assigning a label to an enterprise runner
Assigning a label to a repository runner
- 导航到已注册自托管运行器组的存储库的主页。
- 单击“ Settings”****。
- 在左侧边栏中,单击 “操作”,然后单击“运行器” 。
- 在“Labels(标签)”部分,单击 。
- 要将标签分配给您的自托管运行器,在“Find or create a label(查找或创建标签)”字段中单击标签。
Assigning a label to an organization runner
- 导航到已注册自托管运行器组的组织的主页。
- 单击“ Settings”****。
- 在左侧边栏中,单击 “操作”,然后单击“运行器” 。
- 在“Labels(标签)”部分,单击 。
- 要将标签分配给您的自托管运行器,在“Find or create a label(查找或创建标签)”字段中单击标签。
Assigning a label to an enterprise runner
-
在 的右上角,单击你的个人资料照片,然后单击“企业设置”****。
-
在页面左侧的企业帐户边栏中,单击“ Policies”****
-
在“ 策略”下,单击“操作”。****
-
单击“运行器”选项卡。
-
在运行器列表中,单击要配置的运行器的名称。
-
在“Labels(标签)”部分,单击 。
-
要将标签分配给您的自托管运行器,在“Find or create a label(查找或创建标签)”字段中单击标签。
Removing a custom label from a self-hosted runner
You can remove custom labels from self-hosted runners at the repository, organization, and enterprise levels.
- Removing a custom label from a repository runner
- Removing a custom label from an organization runner
- Removing a custom label from an enterprise runner
Removing a custom label from a repository runner
- 导航到已注册自托管运行器组的存储库的主页。
- 单击“ Settings”****。
- 在左侧边栏中,单击 “操作”,然后单击“运行器” 。
- 在“Labels(标签)”部分,单击 。
- 在“查找或创建标签”字段中,分配的标签标有 图标。 单击标记的标签以将其从您的自托管运行器取消分配。
Removing a custom label from an organization runner
- 导航到已注册自托管运行器组的组织的主页。
- 单击“ Settings”****。
- 在左侧边栏中,单击 “操作”,然后单击“运行器” 。
- 在“Labels(标签)”部分,单击 。
- 在“查找或创建标签”字段中,分配的标签标有 图标。 单击标记的标签以将其从您的自托管运行器取消分配。
Removing a custom label from an enterprise runner
-
在 的右上角,单击你的个人资料照片,然后单击“企业设置”****。
-
在页面左侧的企业帐户边栏中,单击“ Policies”****
-
在“ 策略”下,单击“操作”。****
-
单击“运行器”选项卡。
-
在运行器列表中,单击要配置的运行器的名称。
-
在“Labels(标签)”部分,单击 。
-
在“查找或创建标签”字段中,分配的标签标有 图标。 单击标记的标签以将其从您的自托管运行器取消分配。
Programmatically assign labels
You can programmatically assign labels to a self-hosted runner after the runner is created, or during its initial configuration.
-
To programmatically assign labels to an existing self-hosted runner, you must use the REST API. For more information, see 自托管运行器的 REST API 终结点.
-
To programmatically assign labels to a self-hosted runner during the initial runner configuration, you can pass label names to the
config
script using thelabels
parameter.注意
You cannot use the
config
script to assign labels to an existing self-hosted runner.For example, this command assigns a label named
gpu
when configuring a new self-hosted runner:./config.sh --url <REPOSITORY_URL> --token <REGISTRATION_TOKEN> --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
orlinux
. When default labels are assigned using the configuration script, GitHub 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 --url <REPOSITORY_URL> --token <REGISTRATION_TOKEN> --labels gpu,x64,linux
注意
If you replace an existing runner, then you must reassign any custom labels.