自托管运行器
自托管运行器 API 允许您注册、查看和删除自托管的运行器。
关于自托管运行器 API
自托管运行器 API 允许您注册、查看和删除自托管的运行器。 自托管运行器允许您托管自己的运行器,并自定义用于在 GitHub Actions 工作流程中运行作业的环境。 更多信息请参阅“托管您自己的运行器”。
此 API 适用于经过身份验证的用户、OAuth 应用程序 和 GitHub 应用程序。 访问令牌需要 repo 作用域(对于私有仓库)和 public_repo 作用域(对于公共仓库)。 GitHub 应用程序 必须对仓库具有管理权限,或者对组织具有 organization_self_hosted_runners 权限。 经过身份验证的用户必须具有对存储库或组织的管理员访问权限或者企业的 manage_runners:enterprise 作用域才能使用此 API。
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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
enterprisestring必选The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
| 查询参数 |
| 名称, 类型, 描述 |
per_pageintegerThe number of results per page (max 100). 默认值: |
pageintegerPage number of the results to fetch. 默认值: |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runnersResponse
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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
enterprisestring必选The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/downloadsResponse
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 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
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
enterprisestring必选The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
201 | Created |
代码示例
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/registration-tokenResponse
Status: 201{
"token": "LLBF3JGZDX3P5PMEXLND6TS6FCWO6",
"expires_at": "2020-01-22T12:13:35.123-08:00"
}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
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
enterprisestring必选The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
201 | Created |
代码示例
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/remove-tokenResponse
Status: 201{
"token": "AABF3JGZDX3P5PMEXLND6TS6FCWO6",
"expires_at": "2020-01-29T12:13:35.123-08:00"
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
enterprisestring必选The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_IDResponse
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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
enterprisestring必选The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
204 | No Content |
代码示例
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_IDResponse
Status: 204List 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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
enterprisestring必选The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID/labelsResponse
Status: 200{
"total_count": 4,
"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"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
enterprisestring必选The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
| 正文参数 |
| 名称, 类型, 描述 |
labelsarray of strings必选The names of the custom labels to add to the runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed |
代码示例
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'Response
Status: 200{
"total_count": 4,
"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"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
enterprisestring必选The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
| 正文参数 |
| 名称, 类型, 描述 |
labelsarray of strings必选The names of the custom labels to set for the runner. You can pass an empty array to remove all custom labels. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed |
代码示例
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'Response
Status: 200{
"total_count": 4,
"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"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
enterprisestring必选The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed |
代码示例
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID/labelsResponse
Status: 200{
"total_count": 3,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
enterprisestring必选The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
namestring必选The name of a self-hosted runner's custom label. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed |
代码示例
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/RUNNER_ID/labels/NAMEResponse
Status: 200{
"total_count": 4,
"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 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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
orgstring必选The organization name. The name is not case sensitive. |
| 查询参数 |
| 名称, 类型, 描述 |
per_pageintegerThe number of results per page (max 100). 默认值: |
pageintegerPage number of the results to fetch. 默认值: |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/actions/runnersResponse
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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
orgstring必选The organization name. The name is not case sensitive. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/actions/runners/downloadsResponse
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 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.
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
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
orgstring必选The organization name. The name is not case sensitive. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
201 | Created |
代码示例
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/actions/runners/registration-tokenResponse
Status: 201{
"token": "LLBF3JGZDX3P5PMEXLND6TS6FCWO6",
"expires_at": "2020-01-22T12:13:35.123-08:00"
}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.
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
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
orgstring必选The organization name. The name is not case sensitive. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
201 | Created |
代码示例
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/actions/runners/remove-tokenResponse
Status: 201{
"token": "AABF3JGZDX3P5PMEXLND6TS6FCWO6",
"expires_at": "2020-01-29T12:13:35.123-08:00"
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
orgstring必选The organization name. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_IDResponse
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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
orgstring必选The organization name. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
204 | No Content |
代码示例
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_IDResponse
Status: 204List 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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
orgstring必选The organization name. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID/labelsResponse
Status: 200{
"total_count": 4,
"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"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
orgstring必选The organization name. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
| 正文参数 |
| 名称, 类型, 描述 |
labelsarray of strings必选The names of the custom labels to add to the runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed |
代码示例
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'Response
Status: 200{
"total_count": 4,
"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"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
orgstring必选The organization name. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
| 正文参数 |
| 名称, 类型, 描述 |
labelsarray of strings必选The names of the custom labels to set for the runner. You can pass an empty array to remove all custom labels. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed |
代码示例
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'Response
Status: 200{
"total_count": 4,
"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"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
orgstring必选The organization name. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
代码示例
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID/labelsResponse
Status: 200{
"total_count": 3,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
orgstring必选The organization name. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
namestring必选The name of a self-hosted runner's custom label. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed |
代码示例
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/actions/runners/RUNNER_ID/labels/NAMEResponse
Status: 200{
"total_count": 4,
"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 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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
ownerstring必选The account owner of the repository. The name is not case sensitive. |
repostring必选The name of the repository. The name is not case sensitive. |
| 查询参数 |
| 名称, 类型, 描述 |
per_pageintegerThe number of results per page (max 100). 默认值: |
pageintegerPage number of the results to fetch. 默认值: |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/actions/runnersResponse
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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
ownerstring必选The account owner of the repository. The name is not case sensitive. |
repostring必选The name of the repository. The name is not case sensitive. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/actions/runners/downloadsResponse
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 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.
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
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
ownerstring必选The account owner of the repository. The name is not case sensitive. |
repostring必选The name of the repository. The name is not case sensitive. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
201 | Created |
代码示例
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/actions/runners/registration-tokenResponse
Status: 201{
"token": "LLBF3JGZDX3P5PMEXLND6TS6FCWO6",
"expires_at": "2020-01-22T12:13:35.123-08:00"
}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.
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
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
ownerstring必选The account owner of the repository. The name is not case sensitive. |
repostring必选The name of the repository. The name is not case sensitive. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
201 | Created |
代码示例
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/actions/runners/remove-tokenResponse
Status: 201{
"token": "AABF3JGZDX3P5PMEXLND6TS6FCWO6",
"expires_at": "2020-01-29T12:13:35.123-08:00"
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
ownerstring必选The account owner of the repository. The name is not case sensitive. |
repostring必选The name of the repository. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_IDResponse
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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
ownerstring必选The account owner of the repository. The name is not case sensitive. |
repostring必选The name of the repository. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
204 | No Content |
代码示例
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_IDResponse
Status: 204List 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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
ownerstring必选The account owner of the repository. The name is not case sensitive. |
repostring必选The name of the repository. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
代码示例
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID/labelsResponse
Status: 200{
"total_count": 4,
"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"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
ownerstring必选The account owner of the repository. The name is not case sensitive. |
repostring必选The name of the repository. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
| 正文参数 |
| 名称, 类型, 描述 |
labelsarray of strings必选The names of the custom labels to add to the runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed |
代码示例
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'Response
Status: 200{
"total_count": 4,
"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"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
ownerstring必选The account owner of the repository. The name is not case sensitive. |
repostring必选The name of the repository. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
| 正文参数 |
| 名称, 类型, 描述 |
labelsarray of strings必选The names of the custom labels to set for the runner. You can pass an empty array to remove all custom labels. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed |
代码示例
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID/labels \
-d '{"labels":["gpu","accelerated"]}'Response
Status: 200{
"total_count": 4,
"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"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
ownerstring必选The account owner of the repository. The name is not case sensitive. |
repostring必选The name of the repository. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
代码示例
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID/labelsResponse
Status: 200{
"total_count": 3,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
}
]
}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.
参数
| 标头 |
|---|
| 名称, 类型, 描述 |
acceptstringSetting to |
| 路径参数 |
| 名称, 类型, 描述 |
ownerstring必选The account owner of the repository. The name is not case sensitive. |
repostring必选The name of the repository. The name is not case sensitive. |
runner_idinteger必选Unique identifier of the self-hosted runner. |
namestring必选The name of a self-hosted runner's custom label. |
HTTP 响应状态代码
| 状态代码 | 描述 |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed |
代码示例
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/actions/runners/RUNNER_ID/labels/NAMEResponse
Status: 200{
"total_count": 4,
"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"
}
]
}