Skip to main content

Esta versión de GitHub Enterprise Server se discontinuó el 2024-03-26. No se realizarán lanzamientos de patch, ni siquiera para problemas de seguridad críticos. Para obtener rendimiento mejorado, seguridad mejorada y nuevas características, actualice a la versión más reciente de GitHub Enterprise Server. Para obtener ayuda con la actualización, póngase en contacto con el soporte técnico de GitHub Enterprise.

Después de que un administrador del sitio actualice la instancia de Enterprise Server a Enterprise Server 3.9 o posterior, la API de REST tendrá control de versiones. Para informarte sobre cómo encontrar la versión de tu instancia, consulta "Acerca de las versiones de GitHub Docs". Para obtener más información, consulta "Acerca del control de versiones de la API".

Puntos de conexión de API de REST para flujos de trabajo

Usa la API de REST para interactuar con flujos de trabajo en GitHub Actions.

Acerca de los flujos de trabajo de GitHub Actions

Puedes usar la API de REST para ver flujos de trabajo de un repositorio en GitHub Actions. Los flujos de trabajo automatizan el ciclo de vida de tu desarrollo de software con una amplia gama de herramientas y servicios. Para más información, consulta "Acerca de los flujos de trabajo" en la documentación de 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.

Parámetros para "List repository workflows"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
owner string Requerido

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

repo string Requerido

The name of the repository without the .git extension. The name is not case sensitive.

Parámetros de consulta
Nombre, Tipo, Descripción
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Valor predeterminado: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Valor predeterminado: 1

Códigos de estado de respuesta HTTP para "List repository workflows"

status codeDescripción
200

OK

Ejemplos de código para "List repository workflows"

Ejemplo de solicitud

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

Response

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.

Parámetros para "Get a workflow"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
owner string Requerido

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

repo string Requerido

The name of the repository without the .git extension. The name is not case sensitive.

workflow_id Requerido

The ID of the workflow. You can also pass the workflow file name as a string.

Códigos de estado de respuesta HTTP para "Get a workflow"

status codeDescripción
200

OK

Ejemplos de código para "Get a workflow"

Ejemplo de solicitud

get/repos/{owner}/{repo}/actions/workflows/{workflow_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/workflows/WORKFLOW_ID

Response

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.

Parámetros para "Disable a workflow"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
owner string Requerido

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

repo string Requerido

The name of the repository without the .git extension. The name is not case sensitive.

workflow_id Requerido

The ID of the workflow. You can also pass the workflow file name as a string.

Códigos de estado de respuesta HTTP para "Disable a workflow"

status codeDescripción
204

No Content

Ejemplos de código para "Disable a workflow"

Ejemplo de solicitud

put/repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/workflows/WORKFLOW_ID/disable

Response

Status: 204

Create 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.

Parámetros para "Create a workflow dispatch event"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
owner string Requerido

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

repo string Requerido

The name of the repository without the .git extension. The name is not case sensitive.

workflow_id Requerido

The ID of the workflow. You can also pass the workflow file name as a string.

Parámetros del cuerpo
Nombre, Tipo, Descripción
ref string Requerido

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 inputs are omitted.

Códigos de estado de respuesta HTTP para "Create a workflow dispatch event"

status codeDescripción
204

No Content

Ejemplos de código para "Create a workflow dispatch event"

Ejemplo de solicitud

post/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ 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: 204

Enable 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.

Parámetros para "Enable a workflow"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
owner string Requerido

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

repo string Requerido

The name of the repository without the .git extension. The name is not case sensitive.

workflow_id Requerido

The ID of the workflow. You can also pass the workflow file name as a string.

Códigos de estado de respuesta HTTP para "Enable a workflow"

status codeDescripción
204

No Content

Ejemplos de código para "Enable a workflow"

Ejemplo de solicitud

put/repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/workflows/WORKFLOW_ID/enable

Response

Status: 204