Esta versão do GitHub Enterprise Server foi descontinuada em 2024-07-09. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, segurança aprimorada e novos recursos, atualize para a última versão do GitHub Enterprise Server. Para obter ajuda com a atualização, entre em contato com o suporte do GitHub Enterprise.
Pontos de extremidade da API REST para status de implantação
Use a API REST para gerenciar status de implantação.
List deployment statuses
Users with pull access can view deployment statuses for a deployment:
Parâmetros para "List deployment statuses"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
deployment_id integer Obrigatóriodeployment_id parameter |
Nome, Tipo, Descrição |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
Códigos de status de resposta HTTP para "List deployment statuses"
Código de status | Descrição |
---|---|
200 | OK |
404 | Resource not found |
Exemplos de código para "List deployment statuses"
Exemplo de solicitação
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/deployments/DEPLOYMENT_ID/statuses
Response
Status: 200
[
{
"url": "https://HOSTNAME/repos/octocat/example/deployments/42/statuses/1",
"id": 1,
"node_id": "MDE2OkRlcGxveW1lbnRTdGF0dXMx",
"state": "success",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"description": "Deployment finished successfully.",
"environment": "production",
"target_url": "https://example.com/deployment/42/output",
"created_at": "2012-07-20T01:19:13Z",
"updated_at": "2012-07-20T01:19:13Z",
"deployment_url": "https://HOSTNAME/repos/octocat/example/deployments/42",
"repository_url": "https://HOSTNAME/repos/octocat/example",
"environment_url": "https://test-branch.lab.acme.com",
"log_url": "https://example.com/deployment/42/output"
}
]
Create a deployment status
Users with push
access can create deployment statuses for a given deployment.
OAuth app tokens and personal access tokens (classic) need the repo_deployment
scope to use this endpoint.
Parâmetros para "Create a deployment status"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
deployment_id integer Obrigatóriodeployment_id parameter |
Nome, Tipo, Descrição |
---|
state string ObrigatórioThe state of the status. When you set a transient deployment to Pode ser um dos: |
target_url string The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. Note: It's recommended to use the Padrão: |
log_url string The full URL of the deployment's output. This parameter replaces Padrão: |
description string A short description of the status. The maximum description length is 140 characters. Padrão: |
environment string Name for the target deployment environment, which can be changed when setting a deploy status. For example, |
environment_url string Sets the URL for accessing your environment. Default: Padrão: |
auto_inactive boolean Adds a new |
Códigos de status de resposta HTTP para "Create a deployment status"
Código de status | Descrição |
---|---|
201 | Created |
422 | Validation failed, or the endpoint has been spammed. |
Exemplos de código para "Create a deployment status"
Exemplo de solicitação
curl -L \
-X POST \
-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/deployments/DEPLOYMENT_ID/statuses \
-d '{"environment":"production","state":"success","log_url":"https://example.com/deployment/42/output","description":"Deployment finished successfully."}'
Response
Status: 201
{
"url": "https://HOSTNAME/repos/octocat/example/deployments/42/statuses/1",
"id": 1,
"node_id": "MDE2OkRlcGxveW1lbnRTdGF0dXMx",
"state": "success",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"description": "Deployment finished successfully.",
"environment": "production",
"target_url": "https://example.com/deployment/42/output",
"created_at": "2012-07-20T01:19:13Z",
"updated_at": "2012-07-20T01:19:13Z",
"deployment_url": "https://HOSTNAME/repos/octocat/example/deployments/42",
"repository_url": "https://HOSTNAME/repos/octocat/example",
"environment_url": "https://test-branch.lab.acme.com",
"log_url": "https://example.com/deployment/42/output"
}
Get a deployment status
Users with pull access can view a deployment status for a deployment:
Parâmetros para "Get a deployment status"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
deployment_id integer Obrigatóriodeployment_id parameter |
status_id integer Obrigatório |
Códigos de status de resposta HTTP para "Get a deployment status"
Código de status | Descrição |
---|---|
200 | OK |
404 | Resource not found |
Exemplos de código para "Get a deployment status"
Exemplo de solicitação
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/deployments/DEPLOYMENT_ID/statuses/STATUS_ID
Response
Status: 200
{
"url": "https://HOSTNAME/repos/octocat/example/deployments/42/statuses/1",
"id": 1,
"node_id": "MDE2OkRlcGxveW1lbnRTdGF0dXMx",
"state": "success",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"description": "Deployment finished successfully.",
"environment": "production",
"target_url": "https://example.com/deployment/42/output",
"created_at": "2012-07-20T01:19:13Z",
"updated_at": "2012-07-20T01:19:13Z",
"deployment_url": "https://HOSTNAME/repos/octocat/example/deployments/42",
"repository_url": "https://HOSTNAME/repos/octocat/example",
"environment_url": "https://test-branch.lab.acme.com",
"log_url": "https://example.com/deployment/42/output"
}