status_deployments
Creates, updates, deletes, gets or lists a status_deployments resource.
Overview
| Name | status_deployments |
| Type | Resource |
| Id | github.repos.status_deployments |
Fields
The following fields are returned by SELECT queries:
- get_deployment_status
- list_deployment_statuses
Response
| Name | Datatype | Description |
|---|---|---|
id | integer (int64) | |
node_id | string | (example: MDE2OkRlcGxveW1lbnRTdGF0dXMx) |
created_at | string (date-time) | (example: 2012-07-20T01:19:13Z) |
creator | object | A GitHub user. (title: Simple User) |
deployment_url | string (uri) | (example: https://api.github.com/repos/octocat/example/deployments/42) |
description | string | A short description of the status. (default: , example: Deployment finished successfully.) |
environment | string | The environment of the deployment that the status is for. (default: , example: production) |
environment_url | string (uri) | The URL for accessing your environment. (default: , example: https://staging.example.com/) |
log_url | string (uri) | The URL to associate with this status. (default: , example: https://example.com/deployment/42/output) |
performed_via_github_app | object | GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. (title: GitHub app) |
repository_url | string (uri) | (example: https://api.github.com/repos/octocat/example) |
state | string | The state of the status. (error, failure, inactive, pending, success, queued, in_progress) (example: success) |
target_url | string (uri) | Closing down notice: the URL to associate with this status. (default: , example: https://example.com/deployment/42/output) |
updated_at | string (date-time) | (example: 2012-07-20T01:19:13Z) |
url | string (uri) | (example: https://api.github.com/repos/octocat/example/deployments/42/statuses/1) |
Response
| Name | Datatype | Description |
|---|---|---|
id | integer (int64) | |
node_id | string | (example: MDE2OkRlcGxveW1lbnRTdGF0dXMx) |
created_at | string (date-time) | (example: 2012-07-20T01:19:13Z) |
creator | object | A GitHub user. (title: Simple User) |
deployment_url | string (uri) | (example: https://api.github.com/repos/octocat/example/deployments/42) |
description | string | A short description of the status. (default: , example: Deployment finished successfully.) |
environment | string | The environment of the deployment that the status is for. (default: , example: production) |
environment_url | string (uri) | The URL for accessing your environment. (default: , example: https://staging.example.com/) |
log_url | string (uri) | The URL to associate with this status. (default: , example: https://example.com/deployment/42/output) |
performed_via_github_app | object | GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. (title: GitHub app) |
repository_url | string (uri) | (example: https://api.github.com/repos/octocat/example) |
state | string | The state of the status. (error, failure, inactive, pending, success, queued, in_progress) (example: success) |
target_url | string (uri) | Closing down notice: the URL to associate with this status. (default: , example: https://example.com/deployment/42/output) |
updated_at | string (date-time) | (example: 2012-07-20T01:19:13Z) |
url | string (uri) | (example: https://api.github.com/repos/octocat/example/deployments/42/statuses/1) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_deployment_status | select | owner, repo, deployment_id, status_id | Users with pull access can view a deployment status for a deployment: | |
list_deployment_statuses | select | owner, repo, deployment_id | per_page, page | Users with pull access can view deployment statuses for a deployment: |
create_deployment_status | insert | owner, repo, deployment_id, state | 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. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
deployment_id | integer | deployment_id parameter |
owner | string | The account owner of the repository. The name is not case sensitive. |
repo | string | The name of the repository without the .git extension. The name is not case sensitive. |
status_id | integer | |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
SELECT examples
- get_deployment_status
- list_deployment_statuses
Users with pull access can view a deployment status for a deployment:
SELECT
id,
node_id,
created_at,
creator,
deployment_url,
description,
environment,
environment_url,
log_url,
performed_via_github_app,
repository_url,
state,
target_url,
updated_at,
url
FROM github.repos.status_deployments
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND deployment_id = '{{ deployment_id }}' -- required
AND status_id = '{{ status_id }}' -- required
;
Users with pull access can view deployment statuses for a deployment:
SELECT
id,
node_id,
created_at,
creator,
deployment_url,
description,
environment,
environment_url,
log_url,
performed_via_github_app,
repository_url,
state,
target_url,
updated_at,
url
FROM github.repos.status_deployments
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND deployment_id = '{{ deployment_id }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
INSERT examples
- create_deployment_status
- Manifest
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.
INSERT INTO github.repos.status_deployments (
state,
target_url,
log_url,
description,
environment,
environment_url,
auto_inactive,
owner,
repo,
deployment_id
)
SELECT
'{{ state }}' /* required */,
'{{ target_url }}',
'{{ log_url }}',
'{{ description }}',
'{{ environment }}',
'{{ environment_url }}',
{{ auto_inactive }},
'{{ owner }}',
'{{ repo }}',
'{{ deployment_id }}'
RETURNING
id,
node_id,
created_at,
creator,
deployment_url,
description,
environment,
environment_url,
log_url,
performed_via_github_app,
repository_url,
state,
target_url,
updated_at,
url
;
# Description fields are for documentation purposes
- name: status_deployments
props:
- name: owner
value: "{{ owner }}"
description: Required parameter for the status_deployments resource.
- name: repo
value: "{{ repo }}"
description: Required parameter for the status_deployments resource.
- name: deployment_id
value: {{ deployment_id }}
description: Required parameter for the status_deployments resource.
- name: state
value: "{{ state }}"
description: |
The state of the status. When you set a transient deployment to `inactive`, the deployment will be shown as `destroyed` in GitHub.
valid_values: ['error', 'failure', 'inactive', 'in_progress', 'queued', 'pending', 'success']
- name: target_url
value: "{{ target_url }}"
description: |
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`.
default:
- name: log_url
value: "{{ log_url }}"
description: |
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: `""`
default:
- name: description
value: "{{ description }}"
description: |
A short description of the status. The maximum description length is 140 characters.
default:
- name: environment
value: "{{ environment }}"
description: |
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.
- name: environment_url
value: "{{ environment_url }}"
description: |
Sets the URL for accessing your environment. Default: `""`
default:
- name: auto_inactive
value: {{ auto_inactive }}
description: |
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`