Конечные точки REST API для рабочих процессов
Используйте REST API для взаимодействия с рабочими процессами в GitHub Actions.
Сведения о рабочих процессах в GitHub Actions
Rest API можно использовать для просмотра рабочих процессов для репозитория в GitHub Actions. Рабочие процессы автоматизируют жизненный цикл разработки программного обеспечения, используя широкий ряд инструментов и служб. Дополнительные сведения см. в документации по GitHub Actions.
List repository workflows
Lists the workflows in a repository.
Anyone with read access to the repository can use this endpoint.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.
Подробные маркеры доступа для "List repository workflows
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Actions" repository permissions (read)
Эту конечную точку можно использовать без проверки подлинности или указанных выше разрешений, если запрашиваются только общедоступные ресурсы.
Параметры для "List repository workflows"
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
owner string Обязательное полеThe account owner of the repository. The name is not case sensitive. |
repo string Обязательное полеThe name of the repository without the |
| Имя., Тип, Description |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." По умолчанию.: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." По умолчанию.: |
Коды состояния http-ответа для "List repository workflows"
| Код состояния | Описание |
|---|---|
200 | OK |
Примеры кода для "List repository workflows"
Пример запроса
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/workflowsResponse
Status: 200{
"total_count": 2,
"workflows": [
{
"id": 161335,
"node_id": "MDg6V29ya2Zsb3cxNjEzMzU=",
"name": "CI",
"path": ".github/workflows/blank.yaml",
"state": "active",
"created_at": "2020-01-08T23:48:37.000-08:00",
"updated_at": "2020-01-08T23:50:21.000-08:00",
"url": "https://HOSTNAME/repos/octo-org/octo-repo/actions/workflows/161335",
"html_url": "https://github.com/octo-org/octo-repo/blob/master/.github/workflows/161335",
"badge_url": "https://github.com/octo-org/octo-repo/workflows/CI/badge.svg"
},
{
"id": 269289,
"node_id": "MDE4OldvcmtmbG93IFNlY29uZGFyeTI2OTI4OQ==",
"name": "Linter",
"path": ".github/workflows/linter.yaml",
"state": "active",
"created_at": "2020-01-08T23:48:37.000-08:00",
"updated_at": "2020-01-08T23:50:21.000-08:00",
"url": "https://HOSTNAME/repos/octo-org/octo-repo/actions/workflows/269289",
"html_url": "https://github.com/octo-org/octo-repo/blob/master/.github/workflows/269289",
"badge_url": "https://github.com/octo-org/octo-repo/workflows/Linter/badge.svg"
}
]
}Get a workflow
Gets a specific workflow. You can replace workflow_id with the workflow
file name. For example, you could use main.yaml.
Anyone with read access to the repository can use this endpoint.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.
Подробные маркеры доступа для "Get a workflow
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Actions" repository permissions (read)
Эту конечную точку можно использовать без проверки подлинности или указанных выше разрешений, если запрашиваются только общедоступные ресурсы.
Параметры для "Get a workflow"
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
owner string Обязательное полеThe account owner of the repository. The name is not case sensitive. |
repo string Обязательное полеThe name of the repository without the |
workflow_id Обязательное полеThe ID of the workflow. You can also pass the workflow file name as a string. |
Коды состояния http-ответа для "Get a workflow"
| Код состояния | Описание |
|---|---|
200 | OK |
Примеры кода для "Get a workflow"
Пример запроса
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/workflows/WORKFLOW_IDResponse
Status: 200{
"id": 161335,
"node_id": "MDg6V29ya2Zsb3cxNjEzMzU=",
"name": "CI",
"path": ".github/workflows/blank.yaml",
"state": "active",
"created_at": "2020-01-08T23:48:37.000-08:00",
"updated_at": "2020-01-08T23:50:21.000-08:00",
"url": "https://HOSTNAME/repos/octo-org/octo-repo/actions/workflows/161335",
"html_url": "https://github.com/octo-org/octo-repo/blob/master/.github/workflows/161335",
"badge_url": "https://github.com/octo-org/octo-repo/workflows/CI/badge.svg"
}Disable a workflow
Disables a workflow and sets the state of the workflow to disabled_manually. You can replace workflow_id with the workflow file name. For example, you could use main.yaml.
OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
Подробные маркеры доступа для "Disable a workflow
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Actions" repository permissions (write)
Параметры для "Disable a workflow"
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
owner string Обязательное полеThe account owner of the repository. The name is not case sensitive. |
repo string Обязательное полеThe name of the repository without the |
workflow_id Обязательное полеThe ID of the workflow. You can also pass the workflow file name as a string. |
Коды состояния http-ответа для "Disable a workflow"
| Код состояния | Описание |
|---|---|
204 | No Content |
Примеры кода для "Disable a workflow"
Пример запроса
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/workflows/WORKFLOW_ID/disableResponse
Status: 204Create a workflow dispatch event
You can use this endpoint to manually trigger a GitHub Actions workflow run. You can replace workflow_id with the workflow file name. For example, you could use main.yaml.
You must configure your GitHub Actions workflow to run when the workflow_dispatch webhook event occurs. The inputs are configured in the workflow file. For more information about how to configure the workflow_dispatch event in the workflow file, see "Events that trigger workflows."
OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
Подробные маркеры доступа для "Create a workflow dispatch event
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Actions" repository permissions (write)
Параметры для "Create a workflow dispatch event"
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
owner string Обязательное полеThe account owner of the repository. The name is not case sensitive. |
repo string Обязательное полеThe name of the repository without the |
workflow_id Обязательное полеThe ID of the workflow. You can also pass the workflow file name as a string. |
| Имя., Тип, Description |
|---|
ref string Обязательное полеThe git reference for the workflow. The reference can be a branch or tag name. |
inputs object Input keys and values configured in the workflow file. The maximum number of properties is 10. Any default properties configured in the workflow file will be used when |
Коды состояния http-ответа для "Create a workflow dispatch event"
| Код состояния | Описание |
|---|---|
204 | No Content |
Примеры кода для "Create a workflow dispatch event"
Пример запроса
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/workflows/WORKFLOW_ID/dispatches \
-d '{"ref":"topic-branch","inputs":{"name":"Mona the Octocat","home":"San Francisco, CA"}}'Response
Status: 204Enable a workflow
Enables a workflow and sets the state of the workflow to active. You can replace workflow_id with the workflow file name. For example, you could use main.yaml.
OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
Подробные маркеры доступа для "Enable a workflow
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Actions" repository permissions (write)
Параметры для "Enable a workflow"
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
owner string Обязательное полеThe account owner of the repository. The name is not case sensitive. |
repo string Обязательное полеThe name of the repository without the |
workflow_id Обязательное полеThe ID of the workflow. You can also pass the workflow file name as a string. |
Коды состояния http-ответа для "Enable a workflow"
| Код состояния | Описание |
|---|---|
204 | No Content |
Примеры кода для "Enable a workflow"
Пример запроса
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/workflows/WORKFLOW_ID/enableResponse
Status: 204