New-GitHubRepositoryDeploymentStatus

SYNOPSIS

Create a deployment status

SYNTAX

Default (Default)

New-GitHubRepositoryDeploymentStatus [-Owner] <string> [-Repo] <string> [-DeploymentId] <long>
 -State <string> [-TargetUrl <string>] [-LogUrl <string>] [-Description <string>]
 [-Environment <string>] [-EnvironmentUrl <string>] [-AutoInactive] [-Accept <string>] [-WhatIf]
 [-Confirm]

Body

New-GitHubRepositoryDeploymentStatus [-Owner] <string> [-Repo] <string> [-DeploymentId] <long>
 -Body <Object> [-State <string>] [-TargetUrl <string>] [-LogUrl <string>] [-Description <string>]
 [-Environment <string>] [-EnvironmentUrl <string>] [-AutoInactive] [-Accept <string>] [-WhatIf]
 [-Confirm]

ALIASES

This cmdlet has the following aliases,

  • Get-GHNewRepositoryDeploymentStatus

DESCRIPTION

The New-GitHubRepositoryDeploymentStatus cmdlet invokes the POST method of the /repos/{owner}/{repo}/deployments/{deployment_id}/statuses endpoint (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.

Endpoint: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses API version: 2026-03-10

EXAMPLES

EXAMPLE 1

New-GitHubRepositoryDeploymentStatus -Owner 'octocat' -Repo 'Hello-World' -DeploymentId 1 -State 'error' -Body @{ key = 'value' }

Invokes POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses

EXAMPLE 2

New-GitHubRepositoryDeploymentStatus -Owner 'octocat' -Repo 'Hello-World' -DeploymentId 1 -Body @{ state = 'error' }

Sends the request body from a hashtable, parameters override the keys of -Body

PARAMETERS

-Accept

The Accept header (media type) of the request Default value: application/vnd.github+json

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-AutoInactive

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’

Body property [ auto_inactive ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Body

The whole request body as a hashtable or object. Keys that are also available as parameters are overwritten by the parameter values

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Body
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-DeploymentId

deployment_id parameter

Path parameter [ deployment_id ]

Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 2
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Description

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

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Environment

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.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-EnvironmentUrl

Sets the URL for accessing your environment. Default: ‘””’

Body property [ environment_url ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-LogUrl

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: ‘””’

Body property [ log_url ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Owner

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

Path parameter [ owner ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Repo

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

Path parameter [ repo ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-State

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

Required unless -Body is used

Allowed values: ‘error’, ‘failure’, ‘inactive’, ‘in_progress’, ‘queued’, ‘pending’, ‘success’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Body
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
- Name: Default
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-TargetUrl

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’.

Body property [ target_url ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-WhatIf

Runs the command in a mode that only reports what would happen without performing the actions.

Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Objects with properties named like the path parameters can be piped to this function

{{ Fill in the Description }}

System.String

{{ Fill in the Description }}

System.Int64

{{ Fill in the Description }}

OUTPUTS

The response of the GitHub API (objects

{{ Fill in the Description }}

NOTES

OperationId: repos/create-deployment-status Category: deployments / statuses