New-GitHubRepositoryRelease
SYNOPSIS
Create a release
SYNTAX
Default (Default)
New-GitHubRepositoryRelease [-Owner] <string> [-Repo] <string> -TagName <string>
[-TargetCommitish <string>] [-Name <string>] [-BodyText <string>] [-Draft] [-Prerelease]
[-DiscussionCategoryName <string>] [-GenerateReleaseNotes] [-MakeLatest <string>]
[-Accept <string>] [-WhatIf] [-Confirm]
Body
New-GitHubRepositoryRelease [-Owner] <string> [-Repo] <string> -Body <Object> [-TagName <string>]
[-TargetCommitish <string>] [-Name <string>] [-BodyText <string>] [-Draft] [-Prerelease]
[-DiscussionCategoryName <string>] [-GenerateReleaseNotes] [-MakeLatest <string>]
[-Accept <string>] [-WhatIf] [-Confirm]
ALIASES
This cmdlet has the following aliases,
- Get-GHNewRepositoryRelease
DESCRIPTION
The New-GitHubRepositoryRelease cmdlet invokes the POST method of the /repos/{owner}/{repo}/releases endpoint (Create a release)
Users with push access to the repository can create a release. [!NOTE] If the commit identified by ‘target_commitish’ (or, when ‘target_commitish’ is omitted, the latest commit on the default branch) adds or modifies any file under ‘.github/workflows/’ relative to the repository’s default branch, the authenticating token must be authorized to modify workflows. Otherwise, this endpoint returns ‘404 Not Found’; some authentication paths surface ‘403 Resource not accessible by integration’ instead.
OAuth app tokens and personal access tokens (classic) need the ‘workflow’ scope when the resolved target commit modifies workflow files. Fine-grained access tokens and GitHub App installation tokens also need the “Workflows” repository permission (write). The ‘GITHUB_TOKEN’ available to GitHub Actions cannot be authorized for this; for more information, see “Automatic token authentication (https://docs.github.com/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token)”.
This endpoint triggers notifications (https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see “Rate limits for the API (https://docs.github.com/rest/using-the-rest-api/rate-limits-for-the-rest-api#about-secondary-rate-limits)” and “Best practices for using the REST API (https://docs.github.com/rest/guides/best-practices-for-using-the-rest-api).”
Endpoint: POST /repos/{owner}/{repo}/releases API version: 2026-03-10
EXAMPLES
EXAMPLE 1
New-GitHubRepositoryRelease -Owner 'octocat' -Repo 'Hello-World' -TagName 'v1.0.0' -Body @{ key = 'value' }
Invokes POST /repos/{owner}/{repo}/releases
EXAMPLE 2
New-GitHubRepositoryRelease -Owner 'octocat' -Repo 'Hello-World' -Body @{ tag_name = 'v1.0.0' }
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: ''
-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: ''
-BodyText
Text describing the contents of the tag.
Body property [ body ]
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
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: ''
-DiscussionCategoryName
If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see “Managing categories for discussions in your repository (https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository).”
Body property [ discussion_category_name ]
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Draft
‘true’ to create a draft (unpublished) release, ‘false’ to create a published one.
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: ''
-GenerateReleaseNotes
Whether to automatically generate the name and body for this release. If ‘name’ is specified, the specified name will be used; otherwise, a name will be automatically generated. If ‘body’ is specified, the body will be pre-pended to the automatically generated notes.
Body property [ generate_release_notes ]
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: ''
-MakeLatest
Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Defaults to ‘true’ for newly published releases. ‘legacy’ specifies that the latest release should be determined based on the release creation date and higher semantic version.
Body property [ make_latest ]
Default value: true
Allowed values: ‘true’, ‘false’, ‘legacy’
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Name
The name of the release.
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: ''
-Prerelease
‘true’ to identify the release as a prerelease. ‘false’ to identify the release as a full release.
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: ''
-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: ''
-TagName
The name of the tag.
Required unless -Body is used
Body property [ tag_name ]
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: ''
-TargetCommitish
Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository’s default branch.
Body property [ target_commitish ]
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 }}
OUTPUTS
The response of the GitHub API (objects
{{ Fill in the Description }}
NOTES
OperationId: repos/create-release Category: releases / releases