Esta versão do GitHub Enterprise foi descontinuada em 2022-06-03. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, melhorar a segurança e novos recursos, upgrade to the latest version of GitHub Enterprise. Para ajuda com a atualização, contact GitHub Enterprise support.
Artefatos do GitHub Actions
A API de Artefatos de GitHub Actions permite que você faça o download, exclua e recupere informações sobre artefatos de fluxo de trabalho.
Sobre a API de Artefatos
A API de Artefatos de GitHub Actions permite que você faça o download, exclua e recupere informações sobre artefatos de fluxo de trabalho. Os artefatos permitem compartilhar dados entre tarefas em um fluxo de trabalho e armazenar dados assim que o fluxo de trabalho tiver sido concluído. Para obter mais informações, consulte "Dados recorrentes do fluxo de trabalho que usam artefatos".
Esta API está disponível para usuários autenticados, Aplicativos OAuth e Aplicativos do GitHub. Os tokens de acesso exigem o escopo repositório
para repositórios privados e escopo public_repo
para públicos. Aplicativos do GitHub deve ter a permissão de ações
para usar essa API.
List artifacts for a repository
Lists all artifacts for a repository. 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
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
owner stringObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo stringObrigatórioThe name of the repository. The name is not case sensitive. |
Parâmetros de consulta |
Nome, Tipo, Descrição |
per_page integerThe number of results per page (max 100). Padrão: |
page integerPage number of the results to fetch. Padrão: |
HTTP response status codes
Status code | Descrição |
---|---|
200 | OK |
Amostras de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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://api.github.com/repos/octo-org/octo-docs/actions/artifacts/11",
"archive_download_url": "https://api.github.com/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"
},
{
"id": 13,
"node_id": "MDg6QXJ0aWZhY3QxMw==",
"name": "Test output",
"size_in_bytes": 453,
"url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/13",
"archive_download_url": "https://api.github.com/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"
}
]
}
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 you must use an access token with the repo
scope. GitHub Apps must have the actions:read
permission to use this endpoint.
Parâmetros
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
owner stringObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo stringObrigatórioThe name of the repository. The name is not case sensitive. |
artifact_id integerObrigatórioThe unique identifier of the artifact. |
HTTP response status codes
Status code | Descrição |
---|---|
200 | OK |
Amostras de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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://api.github.com/repos/octo-org/octo-docs/actions/artifacts/11",
"archive_download_url": "https://api.github.com/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"
}
Delete an artifact
Deletes an artifact for a workflow run. You must authenticate using an access token with the repo
scope to use this endpoint. GitHub Apps must have the actions:write
permission to use this endpoint.
Parâmetros
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
owner stringObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo stringObrigatórioThe name of the repository. The name is not case sensitive. |
artifact_id integerObrigatórioThe unique identifier of the artifact. |
HTTP response status codes
Status code | Descrição |
---|---|
204 | No Content |
Amostras de código
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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
. 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
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
owner stringObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo stringObrigatórioThe name of the repository. The name is not case sensitive. |
artifact_id integerObrigatórioThe unique identifier of the artifact. |
archive_format stringObrigatório |
HTTP response status codes
Status code | Descrição |
---|---|
302 | Found |
410 | Gone |
Amostras de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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. 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
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
owner stringObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo stringObrigatórioThe name of the repository. The name is not case sensitive. |
run_id integerObrigatórioThe unique identifier of the workflow run. |
Parâmetros de consulta |
Nome, Tipo, Descrição |
per_page integerThe number of results per page (max 100). Padrão: |
page integerPage number of the results to fetch. Padrão: |
HTTP response status codes
Status code | Descrição |
---|---|
200 | OK |
Amostras de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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://api.github.com/repos/octo-org/octo-docs/actions/artifacts/11",
"archive_download_url": "https://api.github.com/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"
},
{
"id": 13,
"node_id": "MDg6QXJ0aWZhY3QxMw==",
"name": "Test output",
"size_in_bytes": 453,
"url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/13",
"archive_download_url": "https://api.github.com/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"
}
]
}