Skip to main content
Die REST-API verfügt jetzt über eine Versionskontrolle. Weitere Informationen findest du unter Informationen zur API-Versionsverwaltung.

REST-API-Endpunkte für Bereitstellungsstatus

Verwende die REST-API, um Bereitstellungsstatus zu verwalten.

List deployment statuses

Users with pull access can view deployment statuses for a deployment:

Differenzierte Zugriffstoken für "List deployment statuses"

Dieser Endpunkt funktioniert mit den folgenden Tokentypen.:

Das Token muss einen der folgenden Berechtigungssätze aufweisen.:

  • deployments:read

Dieser Endpunkt kann ohne Authentifizierung oder die zuvor erwähnten Berechtigungen verwendet werden, wenn nur öffentliche Ressourcen angefordert werden.

Parameter für „List deployment statuses“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

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

repo string Erforderlich

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

deployment_id integer Erforderlich

deployment_id parameter

Abfrageparameter
Name, type, BESCHREIBUNG
per_page integer

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

Standard: 30

page integer

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

Standard: 1

HTTP-Antwortstatuscodes für „List deployment statuses“

StatuscodeBESCHREIBUNG
200

OK

404

Resource not found

Codebeispiele für „List deployment statuses“

Beispiel für eine Anfrage

get/repos/{owner}/{repo}/deployments/{deployment_id}/statuses
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/deployments/DEPLOYMENT_ID/statuses

Response

Status: 200
[ { "url": "https://api.github.com/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://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/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://api.github.com/repos/octocat/example/deployments/42", "repository_url": "https://api.github.com/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.

Differenzierte Zugriffstoken für "Create a deployment status"

Dieser Endpunkt funktioniert mit den folgenden Tokentypen.:

Das Token muss einen der folgenden Berechtigungssätze aufweisen.:

  • deployments:write

Parameter für „Create a deployment status“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

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

repo string Erforderlich

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

deployment_id integer Erforderlich

deployment_id parameter

Textparameter
Name, type, BESCHREIBUNG
state string Erforderlich

The state of the status. When you set a transient deployment to inactive, the deployment will be shown as destroyed in GitHub.

Kann eine der Folgenden sein: error, failure, inactive, in_progress, queued, pending, success

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 log_url parameter, which replaces target_url.

Standard: ""

log_url string

The full URL of the deployment's output. This parameter replaces target_url. We will continue to accept target_url to support legacy uses, but we recommend replacing target_url with log_url. Setting log_url will automatically set target_url to the same value. Default: ""

Standard: ""

description string

A short description of the status. The maximum description length is 140 characters.

Standard: ""

environment string

Name for the target deployment environment, which can be changed when setting a deploy status. For example, production, staging, or qa. If not defined, the environment of the previous status on the deployment will be used, if it exists. Otherwise, the environment of the deployment will be used.

environment_url string

Sets the URL for accessing your environment. Default: ""

Standard: ""

auto_inactive boolean

Adds a new inactive status to all prior non-transient, non-production environment deployments with the same repository and environment name as the created status's deployment. An inactive status is only added to deployments that had a success state. Default: true

HTTP-Antwortstatuscodes für „Create a deployment status“

StatuscodeBESCHREIBUNG
201

Created

422

Validation failed, or the endpoint has been spammed.

Codebeispiele für „Create a deployment status“

Beispiel für eine Anfrage

post/repos/{owner}/{repo}/deployments/{deployment_id}/statuses
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/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://api.github.com/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://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/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://api.github.com/repos/octocat/example/deployments/42", "repository_url": "https://api.github.com/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:

Differenzierte Zugriffstoken für "Get a deployment status"

Dieser Endpunkt funktioniert mit den folgenden Tokentypen.:

Das Token muss einen der folgenden Berechtigungssätze aufweisen.:

  • deployments:read

Dieser Endpunkt kann ohne Authentifizierung oder die zuvor erwähnten Berechtigungen verwendet werden, wenn nur öffentliche Ressourcen angefordert werden.

Parameter für „Get a deployment status“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

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

repo string Erforderlich

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

deployment_id integer Erforderlich

deployment_id parameter

status_id integer Erforderlich

HTTP-Antwortstatuscodes für „Get a deployment status“

StatuscodeBESCHREIBUNG
200

OK

404

Resource not found

Codebeispiele für „Get a deployment status“

Beispiel für eine Anfrage

get/repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/deployments/DEPLOYMENT_ID/statuses/STATUS_ID

Response

Status: 200
{ "url": "https://api.github.com/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://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/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://api.github.com/repos/octocat/example/deployments/42", "repository_url": "https://api.github.com/repos/octocat/example", "environment_url": "https://test-branch.lab.acme.com", "log_url": "https://example.com/deployment/42/output" }