自托管运行程序
使用 REST API 与 GitHub Actions 中的自托管运行器进行交互。
关于 GitHub Actions
中的自托管运行器
可以使用 REST API 注册、查看并删除 GitHub Actions 中的自托管运行器。 自托管运行器允许您托管自己的运行器,并自定义用于在 GitHub Actions 工作流程中运行作业的环境。 有关详细信息,请参阅“托管您自己的运行器”。
List self-hosted runners for an enterprise
Lists all self-hosted runners configured for an enterprise.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
“List self-hosted runners for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
名称, 类型, 说明 |
---|
name string The name of a self-hosted runner. |
per_page integer The number of results per page (max 100). 默认: |
page integer Page number of the results to fetch. 默认: |
“List self-hosted runners for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List self-hosted runners for an enterprise”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners
Response
Status: 200
{
"total_count": 2,
"runners": [
{
"id": 23,
"name": "linux_runner",
"os": "linux",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 11,
"name": "Linux",
"type": "read-only"
}
]
},
{
"id": 24,
"name": "mac_runner",
"os": "macos",
"status": "offline",
"busy": false,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
]
}
List runner applications for an enterprise
Lists binaries for the runner application that you can download and run.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
“List runner applications for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
“List runner applications for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List runner applications for an enterprise”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/downloads
Response
Status: 200
[
{
"os": "osx",
"architecture": "x64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz",
"filename": "actions-runner-osx-x64-2.164.0.tar.gz"
},
{
"os": "linux",
"architecture": "x64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz",
"filename": "actions-runner-linux-x64-2.164.0.tar.gz"
},
{
"os": "linux",
"architecture": "arm",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz",
"filename": "actions-runner-linux-arm-2.164.0.tar.gz"
},
{
"os": "win",
"architecture": "x64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip",
"filename": "actions-runner-win-x64-2.164.0.zip"
},
{
"os": "linux",
"architecture": "arm64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz",
"filename": "actions-runner-linux-arm64-2.164.0.tar.gz"
}
]
Create configuration for a just-in-time runner for an Enterprise
Generates a configuration that can be passed to the runner application at startup.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
“Create configuration for a just-in-time runner for an Enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
名称, 类型, 说明 |
---|
name string 必须The name of the new runner. |
runner_group_id integer 必须The ID of the runner group to register the runner to. |
labels array of strings 必须The names of the custom labels to add to the runner. Minimum items: 1. Maximum items: 100. |
work_folder string The working directory to be used for job execution, relative to the runner install directory. 默认: |
“Create configuration for a just-in-time runner for an Enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | Created |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Create configuration for a just-in-time runner for an Enterprise”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/generate-jitconfig \
-d '{"name":"New runner","runner_group_id":1,"labels":["self-hosted","X64","macOS","no-gpu"],"work_folder":"_work"}'
Response
Status: 201
{
"runner": {
"id": 23,
"name": "New runner",
"os": "unknown",
"status": "offline",
"busy": false,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
},
"encoded_jit_config": "abc123"
}
Create a registration token for an enterprise
Returns a token that you can pass to the config
script. The token expires after one hour.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
Example using registration token:
Configure your self-hosted runner, replacing TOKEN
with the registration token provided by this endpoint.
./config.sh --url https://github.com/enterprises/octo-enterprise --token TOKEN
“Create a registration token for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
“Create a registration token for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | Created |
“Create a registration token for an enterprise”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/registration-token
Response
Create a remove token for an enterprise
Returns a token that you can pass to the config
script to remove a self-hosted runner from an enterprise. The token expires after one hour.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
Example using remove token:
To remove your self-hosted runner from an enterprise, replace TOKEN
with the remove token provided by this
endpoint.
./config.sh remove --token TOKEN
“Create a remove token for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
“Create a remove token for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | Created |
“Create a remove token for an enterprise”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/remove-token
Response
Get a self-hosted runner for an enterprise
Gets a specific self-hosted runner configured in an enterprise.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
“Get a self-hosted runner for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“Get a self-hosted runner for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get a self-hosted runner for an enterprise”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID
Response
Status: 200
{
"id": 23,
"name": "MBP",
"os": "macos",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
Delete a self-hosted runner from an enterprise
Forces the removal of a self-hosted runner from an enterprise. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
“Delete a self-hosted runner from an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“Delete a self-hosted runner from an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
204 | No Content |
“Delete a self-hosted runner from an enterprise”的示例代码
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID
Response
Status: 204
List labels for a self-hosted runner for an enterprise
Lists all labels for a self-hosted runner configured in an enterprise.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
“List labels for a self-hosted runner for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“List labels for a self-hosted runner for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
“List labels for a self-hosted runner for an enterprise”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID/labels
Response
Add custom labels to a self-hosted runner for an enterprise
Add custom labels to a self-hosted runner configured in an enterprise.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
“Add custom labels to a self-hosted runner for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
名称, 类型, 说明 |
---|
labels array of strings 必须The names of the custom labels to add to the runner. |
“Add custom labels to a self-hosted runner for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Add custom labels to a self-hosted runner for an enterprise”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'
Response
Set custom labels for a self-hosted runner for an enterprise
Remove all previous custom labels and set the new custom labels for a specific self-hosted runner configured in an enterprise.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
“Set custom labels for a self-hosted runner for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
名称, 类型, 说明 |
---|
labels array of strings 必须The names of the custom labels to set for the runner. You can pass an empty array to remove all custom labels. |
“Set custom labels for a self-hosted runner for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Set custom labels for a self-hosted runner for an enterprise”的示例代码
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'
Response
Remove all custom labels from a self-hosted runner for an enterprise
Remove all custom labels from a self-hosted runner configured in an enterprise. Returns the remaining read-only labels from the runner.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
“Remove all custom labels from a self-hosted runner for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“Remove all custom labels from a self-hosted runner for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Remove all custom labels from a self-hosted runner for an enterprise”的示例代码
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID/labels
Response
Remove a custom label from a self-hosted runner for an enterprise
Remove a custom label from a self-hosted runner configured in an enterprise. Returns the remaining labels from the runner.
This endpoint returns a 404 Not Found
status if the custom label is not
present on the runner.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
“Remove a custom label from a self-hosted runner for an enterprise”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
enterprise string 必须The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
name string 必须The name of a self-hosted runner's custom label. |
“Remove a custom label from a self-hosted runner for an enterprise”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Remove a custom label from a self-hosted runner for an enterprise”的示例代码
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID/labels/NAME
Response
List self-hosted runners for an organization
Lists all self-hosted runners configured in an organization.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“List self-hosted runners for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
名称, 类型, 说明 |
---|
name string The name of a self-hosted runner. |
per_page integer The number of results per page (max 100). 默认: |
page integer Page number of the results to fetch. 默认: |
“List self-hosted runners for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List self-hosted runners for an organization”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners
Response
Status: 200
{
"total_count": 2,
"runners": [
{
"id": 23,
"name": "linux_runner",
"os": "linux",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 11,
"name": "Linux",
"type": "read-only"
}
]
},
{
"id": 24,
"name": "mac_runner",
"os": "macos",
"status": "offline",
"busy": false,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
]
}
List runner applications for an organization
Lists binaries for the runner application that you can download and run.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“List runner applications for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
“List runner applications for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List runner applications for an organization”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners/downloads
Response
Status: 200
[
{
"os": "osx",
"architecture": "x64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz",
"filename": "actions-runner-osx-x64-2.164.0.tar.gz"
},
{
"os": "linux",
"architecture": "x64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz",
"filename": "actions-runner-linux-x64-2.164.0.tar.gz"
},
{
"os": "linux",
"architecture": "arm",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz",
"filename": "actions-runner-linux-arm-2.164.0.tar.gz"
},
{
"os": "win",
"architecture": "x64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip",
"filename": "actions-runner-win-x64-2.164.0.zip"
},
{
"os": "linux",
"architecture": "arm64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz",
"filename": "actions-runner-linux-arm64-2.164.0.tar.gz"
}
]
Create configuration for a just-in-time runner for an organization
Generates a configuration that can be passed to the runner application at startup.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Create configuration for a just-in-time runner for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
名称, 类型, 说明 |
---|
name string 必须The name of the new runner. |
runner_group_id integer 必须The ID of the runner group to register the runner to. |
labels array of strings 必须The names of the custom labels to add to the runner. Minimum items: 1. Maximum items: 100. |
work_folder string The working directory to be used for job execution, relative to the runner install directory. 默认: |
“Create configuration for a just-in-time runner for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | Created |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Create configuration for a just-in-time runner for an organization”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners/generate-jitconfig \
-d '{"name":"New runner","runner_group_id":1,"labels":["self-hosted","X64","macOS","no-gpu"],"work_folder":"_work"}'
Response
Status: 201
{
"runner": {
"id": 23,
"name": "New runner",
"os": "unknown",
"status": "offline",
"busy": false,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
},
"encoded_jit_config": "abc123"
}
Create a registration token for an organization
Returns a token that you can pass to the config
script. The token expires after one hour.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
Example using registration token:
Configure your self-hosted runner, replacing TOKEN
with the registration token provided by this endpoint.
./config.sh --url https://github.com/octo-org --token TOKEN
“Create a registration token for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
“Create a registration token for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | Created |
“Create a registration token for an organization”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners/registration-token
Response
Create a remove token for an organization
Returns a token that you can pass to the config
script to remove a self-hosted runner from an organization. The token expires after one hour.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
Example using remove token:
To remove your self-hosted runner from an organization, replace TOKEN
with the remove token provided by this
endpoint.
./config.sh remove --token TOKEN
“Create a remove token for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
“Create a remove token for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | Created |
“Create a remove token for an organization”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners/remove-token
Response
Get a self-hosted runner for an organization
Gets a specific self-hosted runner configured in an organization.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Get a self-hosted runner for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“Get a self-hosted runner for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get a self-hosted runner for an organization”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID
Response
Status: 200
{
"id": 23,
"name": "MBP",
"os": "macos",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
Delete a self-hosted runner from an organization
Forces the removal of a self-hosted runner from an organization. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Delete a self-hosted runner from an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“Delete a self-hosted runner from an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
204 | No Content |
“Delete a self-hosted runner from an organization”的示例代码
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID
Response
Status: 204
List labels for a self-hosted runner for an organization
Lists all labels for a self-hosted runner configured in an organization.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“List labels for a self-hosted runner for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“List labels for a self-hosted runner for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
“List labels for a self-hosted runner for an organization”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID/labels
Response
Add custom labels to a self-hosted runner for an organization
Add custom labels to a self-hosted runner configured in an organization.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Add custom labels to a self-hosted runner for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
名称, 类型, 说明 |
---|
labels array of strings 必须The names of the custom labels to add to the runner. |
“Add custom labels to a self-hosted runner for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Add custom labels to a self-hosted runner for an organization”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'
Response
Set custom labels for a self-hosted runner for an organization
Remove all previous custom labels and set the new custom labels for a specific self-hosted runner configured in an organization.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Set custom labels for a self-hosted runner for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
名称, 类型, 说明 |
---|
labels array of strings 必须The names of the custom labels to set for the runner. You can pass an empty array to remove all custom labels. |
“Set custom labels for a self-hosted runner for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Set custom labels for a self-hosted runner for an organization”的示例代码
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'
Response
Remove all custom labels from a self-hosted runner for an organization
Remove all custom labels from a self-hosted runner configured in an organization. Returns the remaining read-only labels from the runner.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Remove all custom labels from a self-hosted runner for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“Remove all custom labels from a self-hosted runner for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
“Remove all custom labels from a self-hosted runner for an organization”的示例代码
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID/labels
Response
Remove a custom label from a self-hosted runner for an organization
Remove a custom label from a self-hosted runner configured in an organization. Returns the remaining labels from the runner.
This endpoint returns a 404 Not Found
status if the custom label is not
present on the runner.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
If the repository is private, you must use an access token with the repo
scope.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Remove a custom label from a self-hosted runner for an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
runner_id integer 必须Unique identifier of the self-hosted runner. |
name string 必须The name of a self-hosted runner's custom label. |
“Remove a custom label from a self-hosted runner for an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Remove a custom label from a self-hosted runner for an organization”的示例代码
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID/labels/NAME
Response
List self-hosted runners for a repository
Lists all self-hosted runners configured in a repository.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“List self-hosted runners for a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
名称, 类型, 说明 |
---|
name string The name of a self-hosted runner. |
per_page integer The number of results per page (max 100). 默认: |
page integer Page number of the results to fetch. 默认: |
“List self-hosted runners for a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List self-hosted runners for a repository”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners
Response
Status: 200
{
"total_count": 2,
"runners": [
{
"id": 23,
"name": "linux_runner",
"os": "linux",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 11,
"name": "Linux",
"type": "read-only"
}
]
},
{
"id": 24,
"name": "mac_runner",
"os": "macos",
"status": "offline",
"busy": false,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
]
}
List runner applications for a repository
Lists binaries for the runner application that you can download and run.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“List runner applications for a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
“List runner applications for a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“List runner applications for a repository”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners/downloads
Response
Status: 200
[
{
"os": "osx",
"architecture": "x64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz",
"filename": "actions-runner-osx-x64-2.164.0.tar.gz"
},
{
"os": "linux",
"architecture": "x64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz",
"filename": "actions-runner-linux-x64-2.164.0.tar.gz"
},
{
"os": "linux",
"architecture": "arm",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz",
"filename": "actions-runner-linux-arm-2.164.0.tar.gz"
},
{
"os": "win",
"architecture": "x64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip",
"filename": "actions-runner-win-x64-2.164.0.zip"
},
{
"os": "linux",
"architecture": "arm64",
"download_url": "https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz",
"filename": "actions-runner-linux-arm64-2.164.0.tar.gz"
}
]
Create configuration for a just-in-time runner for a repository
Generates a configuration that can be passed to the runner application at startup.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Create configuration for a just-in-time runner for a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
名称, 类型, 说明 |
---|
name string 必须The name of the new runner. |
runner_group_id integer 必须The ID of the runner group to register the runner to. |
labels array of strings 必须The names of the custom labels to add to the runner. Minimum items: 1. Maximum items: 100. |
work_folder string The working directory to be used for job execution, relative to the runner install directory. 默认: |
“Create configuration for a just-in-time runner for a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | Created |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Create configuration for a just-in-time runner for a repository”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners/generate-jitconfig \
-d '{"name":"New runner","runner_group_id":1,"labels":["self-hosted","X64","macOS","no-gpu"],"work_folder":"_work"}'
Response
Status: 201
{
"runner": {
"id": 23,
"name": "New runner",
"os": "unknown",
"status": "offline",
"busy": false,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
},
"encoded_jit_config": "abc123"
}
Create a registration token for a repository
Returns a token that you can pass to the config
script. The token
expires after one hour.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
Example using registration token:
Configure your self-hosted runner, replacing TOKEN
with the registration token provided
by this endpoint.
config.sh --url https://github.com/octo-org/octo-repo-artifacts --token TOKEN
“Create a registration token for a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
“Create a registration token for a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | Created |
“Create a registration token for a repository”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners/registration-token
Response
Create a remove token for a repository
Returns a token that you can pass to remove a self-hosted runner from a repository. The token expires after one hour.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
Example using remove token:
To remove your self-hosted runner from a repository, replace TOKEN with the remove token provided by this endpoint.
config.sh remove --token TOKEN
“Create a remove token for a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
“Create a remove token for a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | Created |
“Create a remove token for a repository”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners/remove-token
Response
Get a self-hosted runner for a repository
Gets a specific self-hosted runner configured in a repository.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Get a self-hosted runner for a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“Get a self-hosted runner for a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
“Get a self-hosted runner for a repository”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID
Response
Status: 200
{
"id": 23,
"name": "MBP",
"os": "macos",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
Delete a self-hosted runner from a repository
Forces the removal of a self-hosted runner from a repository. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Delete a self-hosted runner from a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“Delete a self-hosted runner from a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
204 | No Content |
“Delete a self-hosted runner from a repository”的示例代码
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID
Response
Status: 204
List labels for a self-hosted runner for a repository
Lists all labels for a self-hosted runner configured in a repository.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“List labels for a self-hosted runner for a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“List labels for a self-hosted runner for a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
“List labels for a self-hosted runner for a repository”的示例代码
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID/labels
Response
Add custom labels to a self-hosted runner for a repository
Add custom labels to a self-hosted runner configured in a repository.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Add custom labels to a self-hosted runner for a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
runner_id integer 必须Unique identifier of the self-hosted runner. |
名称, 类型, 说明 |
---|
labels array of strings 必须The names of the custom labels to add to the runner. |
“Add custom labels to a self-hosted runner for a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Add custom labels to a self-hosted runner for a repository”的示例代码
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'
Response
Set custom labels for a self-hosted runner for a repository
Remove all previous custom labels and set the new custom labels for a specific self-hosted runner configured in a repository.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Set custom labels for a self-hosted runner for a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
runner_id integer 必须Unique identifier of the self-hosted runner. |
名称, 类型, 说明 |
---|
labels array of strings 必须The names of the custom labels to set for the runner. You can pass an empty array to remove all custom labels. |
“Set custom labels for a self-hosted runner for a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Set custom labels for a self-hosted runner for a repository”的示例代码
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'
Response
Remove all custom labels from a self-hosted runner for a repository
Remove all custom labels from a self-hosted runner configured in a repository. Returns the remaining read-only labels from the runner.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Remove all custom labels from a self-hosted runner for a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
runner_id integer 必须Unique identifier of the self-hosted runner. |
“Remove all custom labels from a self-hosted runner for a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
“Remove all custom labels from a self-hosted runner for a repository”的示例代码
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID/labels
Response
Remove a custom label from a self-hosted runner for a repository
Remove a custom label from a self-hosted runner configured in a repository. Returns the remaining labels from the runner.
This endpoint returns a 404 Not Found
status if the custom label is not
present on the runner.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the administration
permission for repositories and the organization_self_hosted_runners
permission for organizations.
Authenticated users must have admin access to repositories or organizations, or the manage_runners:enterprise
scope for enterprises, to use these endpoints.
“Remove a custom label from a self-hosted runner for a repository”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
owner string 必须The account owner of the repository. The name is not case sensitive. |
repo string 必须The name of the repository without the |
runner_id integer 必须Unique identifier of the self-hosted runner. |
name string 必须The name of a self-hosted runner's custom label. |
“Remove a custom label from a self-hosted runner for a repository”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Remove a custom label from a self-hosted runner for a repository”的示例代码
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID/labels/NAME
Response