Skip to main content
Frecuentemente publicamos actualizaciones de nuestra documentación. Es posible que la traducción de esta página esté en curso. Para conocer la información más actual, visita la documentación en inglés. Si existe un problema con las traducciones en esta página, por favor infórmanos.

Esta versión de GitHub Enterprise se discontinuó el 2022-06-03. No se realizarán lanzamientos de patch, ni siquiera para problemas de seguridad críticos. Para obtener un mejor desempeño, más seguridad y nuevas características, actualiza a la última versión de GitHub Enterprise. Para obtener ayuda con la actualización, contacta al soporte de GitHub Enterprise.

Jobs de los flujos de trabajo

La API de Jobs de Flujos de Trabajo te permite ver las bitácoras y los jobs de un flujo de trabajo.

About the Workflow jobs API

The Workflow jobs API allows you to view logs and workflow jobs. Un job de flujode trabajo es un cconjunto de pasos que se ejecutan en el mismo ejecutor. Para obtener más información, consulta la sección "Sintaxis de flujode trabajo para GitHub Actions".

Esta API se encuentra disponible para los usuarios autenticados, las OAuth Apps y las GitHub Apps. Los tokens de acceso requieren el alcance repo para los repositorios privados y el alcancepublic_repo para los repositorios públicos. Las GitHub Apps deben tener el permiso de actions para utilizar esta API.

Get a job for a workflow run

Funciona con GitHub Apps

Gets a specific job in a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint.

Parámetros

Encabezados
Nombre, Tipo, Descripción
acceptstring

Setting to application/vnd.github.v3+json is recommended.

Parámetros de ruta
Nombre, Tipo, Descripción
ownerstringRequerido

The account owner of the repository. The name is not case sensitive.

repostringRequerido

The name of the repository. The name is not case sensitive.

job_idintegerRequerido

The unique identifier of the job.

Códigos de estado de respuesta HTTP

Código de estadoDescripción
200

OK

Ejemplos de código

get/repos/{owner}/{repo}/actions/jobs/{job_id}
curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/jobs/JOB_ID

Response

Status: 200
{ "id": 399444496, "run_id": 29679449, "run_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/29679449", "node_id": "MDEyOldvcmtmbG93IEpvYjM5OTQ0NDQ5Ng==", "head_sha": "f83a356604ae3c5d03e1b46ef4d1ca77d64a90b0", "url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/399444496", "html_url": "https://github.com/octo-org/octo-repo/runs/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://api.github.com/repos/octo-org/octo-repo/check-runs/399444496" }

Download job logs for a workflow run

Funciona con GitHub Apps

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 you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint.

Parámetros

Encabezados
Nombre, Tipo, Descripción
acceptstring

Setting to application/vnd.github.v3+json is recommended.

Parámetros de ruta
Nombre, Tipo, Descripción
ownerstringRequerido

The account owner of the repository. The name is not case sensitive.

repostringRequerido

The name of the repository. The name is not case sensitive.

job_idintegerRequerido

The unique identifier of the job.

Códigos de estado de respuesta HTTP

Código de estadoDescripción
302

Found

Ejemplos de código

get/repos/{owner}/{repo}/actions/jobs/{job_id}/logs
curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/jobs/JOB_ID/logs

Response

Status: 302

List jobs for a workflow run

Funciona con GitHub Apps

Lists jobs for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint. You can use parameters to narrow the list of results. For more information about using parameters, see Parameters.

Parámetros

Encabezados
Nombre, Tipo, Descripción
acceptstring

Setting to application/vnd.github.v3+json is recommended.

Parámetros de ruta
Nombre, Tipo, Descripción
ownerstringRequerido

The account owner of the repository. The name is not case sensitive.

repostringRequerido

The name of the repository. The name is not case sensitive.

run_idintegerRequerido

The unique identifier of the workflow run.

Parámetros de consulta
Nombre, Tipo, Descripción
filterstring

Filters jobs by their completed_at timestamp. latest returns jobs from the most recent execution of the workflow run. all returns all jobs for a workflow run, including from old executions of the workflow run.

Predeterminado: latest

Puede ser una de las siguientes: latest, all

per_pageinteger

The number of results per page (max 100).

Predeterminado: 30

pageinteger

Page number of the results to fetch.

Predeterminado: 1

Códigos de estado de respuesta HTTP

Código de estadoDescripción
200

OK

Ejemplos de código

get/repos/{owner}/{repo}/actions/runs/{run_id}/jobs
curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ 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://api.github.com/repos/octo-org/octo-repo/actions/runs/29679449", "node_id": "MDEyOldvcmtmbG93IEpvYjM5OTQ0NDQ5Ng==", "head_sha": "f83a356604ae3c5d03e1b46ef4d1ca77d64a90b0", "url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/399444496", "html_url": "https://github.com/octo-org/octo-repo/runs/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://api.github.com/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" } ] }