Конечные точки REST API для заданий рабочих процессов
Используйте REST API для взаимодействия с заданиями рабочих процессов в GitHub Actions.
Сведения о заданиях рабочих процессов в GitHub Actions
Rest API можно использовать для просмотра журналов и заданий рабочих процессов в GitHub Actions. Задание рабочего процесса — это ряд действий, выполняемых в одном и том же средстве выполнения. Дополнительные сведения см. в разделе "Синтаксис рабочего процесса для GitHub Actions".
Get a job for a workflow run
Gets a specific job in a workflow run.
Anyone with read access to the repository can use this endpoint.
If the repository is private, OAuth tokens and personal access tokens (classic) need the repo
scope to use this endpoint.
Подробные маркеры доступа для "Get a job for a workflow run
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Actions" repository permissions (read)
Эту конечную точку можно использовать без проверки подлинности или указанных выше разрешений, если запрашиваются только общедоступные ресурсы.
Параметры для "Get a job for a workflow run"
Имя., Тип, 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 |
job_id integer Обязательное полеThe unique identifier of the job. |
Коды состояния http-ответа для "Get a job for a workflow run"
Код состояния | Описание |
---|---|
200 | OK |
Примеры кода для "Get a job for a workflow run"
Пример запроса
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/jobs/JOB_ID
Response
Status: 200
{
"id": 399444496,
"run_id": 29679449,
"run_url": "https://HOSTNAME/repos/octo-org/octo-repo/actions/runs/29679449",
"node_id": "MDEyOldvcmtmbG93IEpvYjM5OTQ0NDQ5Ng==",
"head_sha": "f83a356604ae3c5d03e1b46ef4d1ca77d64a90b0",
"url": "https://HOSTNAME/repos/octo-org/octo-repo/actions/jobs/399444496",
"html_url": "https://github.com/octo-org/octo-repo/runs/29679449/jobs/399444496",
"status": "completed",
"conclusion": "success",
"started_at": "2020-01-20T17:42:40Z",
"completed_at": "2020-01-20T17:44:39Z",
"name": "build",
"steps": [
{
"name": "Set up job",
"status": "completed",
"conclusion": "success",
"number": 1,
"started_at": "2020-01-20T09:42:40.000-08:00",
"completed_at": "2020-01-20T09:42:41.000-08:00"
},
{
"name": "Run actions/checkout@v2",
"status": "completed",
"conclusion": "success",
"number": 2,
"started_at": "2020-01-20T09:42:41.000-08:00",
"completed_at": "2020-01-20T09:42:45.000-08:00"
},
{
"name": "Set up Ruby",
"status": "completed",
"conclusion": "success",
"number": 3,
"started_at": "2020-01-20T09:42:45.000-08:00",
"completed_at": "2020-01-20T09:42:45.000-08:00"
},
{
"name": "Run actions/cache@v3",
"status": "completed",
"conclusion": "success",
"number": 4,
"started_at": "2020-01-20T09:42:45.000-08:00",
"completed_at": "2020-01-20T09:42:48.000-08:00"
},
{
"name": "Install Bundler",
"status": "completed",
"conclusion": "success",
"number": 5,
"started_at": "2020-01-20T09:42:48.000-08:00",
"completed_at": "2020-01-20T09:42:52.000-08:00"
},
{
"name": "Install Gems",
"status": "completed",
"conclusion": "success",
"number": 6,
"started_at": "2020-01-20T09:42:52.000-08:00",
"completed_at": "2020-01-20T09:42:53.000-08:00"
},
{
"name": "Run Tests",
"status": "completed",
"conclusion": "success",
"number": 7,
"started_at": "2020-01-20T09:42:53.000-08:00",
"completed_at": "2020-01-20T09:42:59.000-08:00"
},
{
"name": "Deploy to Heroku",
"status": "completed",
"conclusion": "success",
"number": 8,
"started_at": "2020-01-20T09:42:59.000-08:00",
"completed_at": "2020-01-20T09:44:39.000-08:00"
},
{
"name": "Post actions/cache@v3",
"status": "completed",
"conclusion": "success",
"number": 16,
"started_at": "2020-01-20T09:44:39.000-08:00",
"completed_at": "2020-01-20T09:44:39.000-08:00"
},
{
"name": "Complete job",
"status": "completed",
"conclusion": "success",
"number": 17,
"started_at": "2020-01-20T09:44:39.000-08:00",
"completed_at": "2020-01-20T09:44:39.000-08:00"
}
],
"check_run_url": "https://HOSTNAME/repos/octo-org/octo-repo/check-runs/399444496",
"labels": [
"self-hosted",
"foo",
"bar"
],
"runner_id": 1,
"runner_name": "my runner",
"runner_group_id": 2,
"runner_group_name": "my runner group",
"workflow_name": "CI",
"head_branch": "main"
}
Download job logs for a workflow run
Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look
for Location:
in the response header to find the URL for the download.
Anyone with read access to the repository can use this endpoint.
If the repository is private, OAuth tokens and personal access tokens (classic) need the repo
scope to use this endpoint.
Подробные маркеры доступа для "Download job logs for a workflow run
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Actions" repository permissions (read)
Эту конечную точку можно использовать без проверки подлинности или указанных выше разрешений, если запрашиваются только общедоступные ресурсы.
Параметры для "Download job logs for a workflow run"
Имя., Тип, 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 |
job_id integer Обязательное полеThe unique identifier of the job. |
Коды состояния http-ответа для "Download job logs for a workflow run"
Код состояния | Описание |
---|---|
302 | Found |
Примеры кода для "Download job logs for a workflow run"
Пример запроса
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/jobs/JOB_ID/logs
Response
Status: 302
List jobs for a workflow run attempt
Lists jobs for a specific workflow run attempt. You can use parameters to narrow the list of results. For more information about using parameters, see Parameters.
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 jobs for a workflow run attempt
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Actions" repository permissions (read)
Эту конечную точку можно использовать без проверки подлинности или указанных выше разрешений, если запрашиваются только общедоступные ресурсы.
Параметры для "List jobs for a workflow run attempt"
Имя., Тип, 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 |
run_id integer Обязательное полеThe unique identifier of the workflow run. |
attempt_number integer Обязательное полеThe attempt number of the workflow run. |
Имя., Тип, 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 jobs for a workflow run attempt"
Код состояния | Описание |
---|---|
200 | OK |
404 | Resource not found |
Примеры кода для "List jobs for a workflow run attempt"
Пример запроса
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/runs/RUN_ID/attempts/ATTEMPT_NUMBER/jobs
Response
Status: 200
{
"total_count": 1,
"jobs": [
{
"id": 399444496,
"run_id": 29679449,
"run_url": "https://HOSTNAME/repos/octo-org/octo-repo/actions/runs/29679449",
"node_id": "MDEyOldvcmtmbG93IEpvYjM5OTQ0NDQ5Ng==",
"head_sha": "f83a356604ae3c5d03e1b46ef4d1ca77d64a90b0",
"url": "https://HOSTNAME/repos/octo-org/octo-repo/actions/jobs/399444496",
"html_url": "https://github.com/octo-org/octo-repo/runs/29679449/jobs/399444496",
"status": "completed",
"conclusion": "success",
"started_at": "2020-01-20T17:42:40Z",
"completed_at": "2020-01-20T17:44:39Z",
"name": "build",
"steps": [
{
"name": "Set up job",
"status": "completed",
"conclusion": "success",
"number": 1,
"started_at": "2020-01-20T09:42:40.000-08:00",
"completed_at": "2020-01-20T09:42:41.000-08:00"
},
{
"name": "Run actions/checkout@v2",
"status": "completed",
"conclusion": "success",
"number": 2,
"started_at": "2020-01-20T09:42:41.000-08:00",
"completed_at": "2020-01-20T09:42:45.000-08:00"
},
{
"name": "Set up Ruby",
"status": "completed",
"conclusion": "success",
"number": 3,
"started_at": "2020-01-20T09:42:45.000-08:00",
"completed_at": "2020-01-20T09:42:45.000-08:00"
},
{
"name": "Run actions/cache@v3",
"status": "completed",
"conclusion": "success",
"number": 4,
"started_at": "2020-01-20T09:42:45.000-08:00",
"completed_at": "2020-01-20T09:42:48.000-08:00"
},
{
"name": "Install Bundler",
"status": "completed",
"conclusion": "success",
"number": 5,
"started_at": "2020-01-20T09:42:48.000-08:00",
"completed_at": "2020-01-20T09:42:52.000-08:00"
},
{
"name": "Install Gems",
"status": "completed",
"conclusion": "success",
"number": 6,
"started_at": "2020-01-20T09:42:52.000-08:00",
"completed_at": "2020-01-20T09:42:53.000-08:00"
},
{
"name": "Run Tests",
"status": "completed",
"conclusion": "success",
"number": 7,
"started_at": "2020-01-20T09:42:53.000-08:00",
"completed_at": "2020-01-20T09:42:59.000-08:00"
},
{
"name": "Deploy to Heroku",
"status": "completed",
"conclusion": "success",
"number": 8,
"started_at": "2020-01-20T09:42:59.000-08:00",
"completed_at": "2020-01-20T09:44:39.000-08:00"
},
{
"name": "Post actions/cache@v3",
"status": "completed",
"conclusion": "success",
"number": 16,
"started_at": "2020-01-20T09:44:39.000-08:00",
"completed_at": "2020-01-20T09:44:39.000-08:00"
},
{
"name": "Complete job",
"status": "completed",
"conclusion": "success",
"number": 17,
"started_at": "2020-01-20T09:44:39.000-08:00",
"completed_at": "2020-01-20T09:44:39.000-08:00"
}
],
"check_run_url": "https://HOSTNAME/repos/octo-org/octo-repo/check-runs/399444496",
"labels": [
"self-hosted",
"foo",
"bar"
],
"runner_id": 1,
"runner_name": "my runner",
"runner_group_id": 2,
"runner_group_name": "my runner group",
"workflow_name": "CI",
"head_branch": "main"
}
]
}
List jobs for a workflow run
Lists jobs for a workflow run. You can use parameters to narrow the list of results. For more information about using parameters, see Parameters.
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 jobs for a workflow run
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Actions" repository permissions (read)
Эту конечную точку можно использовать без проверки подлинности или указанных выше разрешений, если запрашиваются только общедоступные ресурсы.
Параметры для "List jobs for a workflow run"
Имя., Тип, 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 |
run_id integer Обязательное полеThe unique identifier of the workflow run. |
Имя., Тип, Description |
---|
filter string Filters jobs by their По умолчанию.: Возможные значения: |
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 jobs for a workflow run"
Код состояния | Описание |
---|---|
200 | OK |
Примеры кода для "List jobs for a workflow run"
Пример запроса
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/runs/RUN_ID/jobs
Response
Status: 200
{
"total_count": 1,
"jobs": [
{
"id": 399444496,
"run_id": 29679449,
"run_url": "https://HOSTNAME/repos/octo-org/octo-repo/actions/runs/29679449",
"node_id": "MDEyOldvcmtmbG93IEpvYjM5OTQ0NDQ5Ng==",
"head_sha": "f83a356604ae3c5d03e1b46ef4d1ca77d64a90b0",
"url": "https://HOSTNAME/repos/octo-org/octo-repo/actions/jobs/399444496",
"html_url": "https://github.com/octo-org/octo-repo/runs/29679449/jobs/399444496",
"status": "completed",
"conclusion": "success",
"started_at": "2020-01-20T17:42:40Z",
"completed_at": "2020-01-20T17:44:39Z",
"name": "build",
"steps": [
{
"name": "Set up job",
"status": "completed",
"conclusion": "success",
"number": 1,
"started_at": "2020-01-20T09:42:40.000-08:00",
"completed_at": "2020-01-20T09:42:41.000-08:00"
},
{
"name": "Run actions/checkout@v2",
"status": "completed",
"conclusion": "success",
"number": 2,
"started_at": "2020-01-20T09:42:41.000-08:00",
"completed_at": "2020-01-20T09:42:45.000-08:00"
},
{
"name": "Set up Ruby",
"status": "completed",
"conclusion": "success",
"number": 3,
"started_at": "2020-01-20T09:42:45.000-08:00",
"completed_at": "2020-01-20T09:42:45.000-08:00"
},
{
"name": "Run actions/cache@v3",
"status": "completed",
"conclusion": "success",
"number": 4,
"started_at": "2020-01-20T09:42:45.000-08:00",
"completed_at": "2020-01-20T09:42:48.000-08:00"
},
{
"name": "Install Bundler",
"status": "completed",
"conclusion": "success",
"number": 5,
"started_at": "2020-01-20T09:42:48.000-08:00",
"completed_at": "2020-01-20T09:42:52.000-08:00"
},
{
"name": "Install Gems",
"status": "completed",
"conclusion": "success",
"number": 6,
"started_at": "2020-01-20T09:42:52.000-08:00",
"completed_at": "2020-01-20T09:42:53.000-08:00"
},
{
"name": "Run Tests",
"status": "completed",
"conclusion": "success",
"number": 7,
"started_at": "2020-01-20T09:42:53.000-08:00",
"completed_at": "2020-01-20T09:42:59.000-08:00"
},
{
"name": "Deploy to Heroku",
"status": "completed",
"conclusion": "success",
"number": 8,
"started_at": "2020-01-20T09:42:59.000-08:00",
"completed_at": "2020-01-20T09:44:39.000-08:00"
},
{
"name": "Post actions/cache@v3",
"status": "completed",
"conclusion": "success",
"number": 16,
"started_at": "2020-01-20T09:44:39.000-08:00",
"completed_at": "2020-01-20T09:44:39.000-08:00"
},
{
"name": "Complete job",
"status": "completed",
"conclusion": "success",
"number": 17,
"started_at": "2020-01-20T09:44:39.000-08:00",
"completed_at": "2020-01-20T09:44:39.000-08:00"
}
],
"check_run_url": "https://HOSTNAME/repos/octo-org/octo-repo/check-runs/399444496",
"labels": [
"self-hosted",
"foo",
"bar"
],
"runner_id": 1,
"runner_name": "my runner",
"runner_group_id": 2,
"runner_group_name": "my runner group",
"workflow_name": "CI",
"head_branch": "main"
}
]
}