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 artefactos de Acciones de GitHub

Usa la API REST para interactuar con artefactos en GitHub Actions.

Acerca de los artefactos en GitHub Actions

Puedes usar la API REST para descargar, eliminar y recuperar información sobre los artefactos de flujo de trabajo en GitHub Actions. Los artefactos te habilitan para compartir datos entre jobs en un flujo de trabajo y para almacenar datos una vez que este flujo se complete. Para obtener más información, consulte "Almacenar los datos de los flujos de trabajo como artefactos".

List artifacts for a repository

Lists all artifacts for 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 artifacts for a repository"

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

name string

The name field of an artifact. When specified, only artifacts with this name will be returned.

Códigos de estado de respuesta HTTP para "List artifacts for a repository"

status codeDescripción
200

OK

Ejemplos de código para "List artifacts for a repository"

Ejemplo de solicitud

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

Response

Status: 200
{ "total_count": 2, "artifacts": [ { "id": 11, "node_id": "MDg6QXJ0aWZhY3QxMQ==", "name": "Rails", "size_in_bytes": 556, "url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/11", "archive_download_url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/11/zip", "expired": false, "created_at": "2020-01-10T14:59:22Z", "expires_at": "2020-03-21T14:59:22Z", "updated_at": "2020-02-21T14:59:22Z", "workflow_run": { "id": 2332938, "repository_id": 1296269, "head_repository_id": 1296269, "head_branch": "main", "head_sha": "328faa0536e6fef19753d9d91dc96a9931694ce3" } }, { "id": 13, "node_id": "MDg6QXJ0aWZhY3QxMw==", "name": "Test output", "size_in_bytes": 453, "url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/13", "archive_download_url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/13/zip", "expired": false, "created_at": "2020-01-10T14:59:22Z", "expires_at": "2020-03-21T14:59:22Z", "updated_at": "2020-02-21T14:59:22Z", "workflow_run": { "id": 2332942, "repository_id": 1296269, "head_repository_id": 1296269, "head_branch": "main", "head_sha": "178f4f6090b3fccad4a65b3e83d076a622d59652" } } ] }

Get an artifact

Gets a specific artifact for 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.

Parámetros para "Get an artifact"

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.

artifact_id integer Requerido

The unique identifier of the artifact.

Códigos de estado de respuesta HTTP para "Get an artifact"

status codeDescripción
200

OK

Ejemplos de código para "Get an artifact"

Ejemplo de solicitud

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

Response

Status: 200
{ "id": 11, "node_id": "MDg6QXJ0aWZhY3QxMQ==", "name": "Rails", "size_in_bytes": 556, "url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/11", "archive_download_url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/11/zip", "expired": false, "created_at": "2020-01-10T14:59:22Z", "expires_at": "2020-01-21T14:59:22Z", "updated_at": "2020-01-21T14:59:22Z", "workflow_run": { "id": 2332938, "repository_id": 1296269, "head_repository_id": 1296269, "head_branch": "main", "head_sha": "328faa0536e6fef19753d9d91dc96a9931694ce3" } }

Delete an artifact

Deletes an artifact for a workflow run. OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

Parámetros para "Delete an artifact"

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.

artifact_id integer Requerido

The unique identifier of the artifact.

Códigos de estado de respuesta HTTP para "Delete an artifact"

status codeDescripción
204

No Content

Ejemplos de código para "Delete an artifact"

Ejemplo de solicitud

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

Response

Status: 204

Download an artifact

Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for Location: in the response header to find the URL for the download. The :archive_format must be zip.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

Parámetros para "Download an artifact"

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.

artifact_id integer Requerido

The unique identifier of the artifact.

archive_format string Requerido

Códigos de estado de respuesta HTTP para "Download an artifact"

status codeDescripción
302

Found

410

Gone

Ejemplos de código para "Download an artifact"

Ejemplo de solicitud

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

Response

Status: 302

List workflow run artifacts

Lists artifacts for a workflow run.

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 workflow run artifacts"

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.

run_id integer Requerido

The unique identifier of the workflow run.

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

name string

The name field of an artifact. When specified, only artifacts with this name will be returned.

Códigos de estado de respuesta HTTP para "List workflow run artifacts"

status codeDescripción
200

OK

Ejemplos de código para "List workflow run artifacts"

Ejemplo de solicitud

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

Response

Status: 200
{ "total_count": 2, "artifacts": [ { "id": 11, "node_id": "MDg6QXJ0aWZhY3QxMQ==", "name": "Rails", "size_in_bytes": 556, "url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/11", "archive_download_url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/11/zip", "expired": false, "created_at": "2020-01-10T14:59:22Z", "expires_at": "2020-03-21T14:59:22Z", "updated_at": "2020-02-21T14:59:22Z", "workflow_run": { "id": 2332938, "repository_id": 1296269, "head_repository_id": 1296269, "head_branch": "main", "head_sha": "328faa0536e6fef19753d9d91dc96a9931694ce3" } }, { "id": 13, "node_id": "MDg6QXJ0aWZhY3QxMw==", "name": "Test output", "size_in_bytes": 453, "url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/13", "archive_download_url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/13/zip", "expired": false, "created_at": "2020-01-10T14:59:22Z", "expires_at": "2020-03-21T14:59:22Z", "updated_at": "2020-02-21T14:59:22Z", "workflow_run": { "id": 2332942, "repository_id": 1296269, "head_repository_id": 1296269, "head_branch": "main", "head_sha": "178f4f6090b3fccad4a65b3e83d076a622d59652" } } ] }