New-GitHubPullRequestReview

SYNOPSIS

Create a review for a pull request

SYNTAX

__AllParameterSets

New-GitHubPullRequestReview [-Owner] <string> [-Repo] <string> [-PullNumber] <long>
 [-CommitId <string>] [-BodyText <string>] [-BodyEvent <string>] [-Comments <Object[]>]
 [-Body <Object>] [-Accept <string>] [-WhatIf] [-Confirm]

ALIASES

This cmdlet has the following aliases,

  • Get-GHNewPullRequestReview

DESCRIPTION

The New-GitHubPullRequestReview cmdlet invokes the POST method of the /repos/{owner}/{repo}/pulls/{pull_number}/reviews endpoint (Create a review for a pull request)

Creates a review on a specified pull request.

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).”

Pull request reviews created in the ‘PENDING’ state are not submitted and therefore do not include the ‘submitted_at’ property in the response. To create a pending review for a pull request, leave the ‘event’ parameter blank. For more information about submitting a ‘PENDING’ review, see “Submit a review for a pull request (https://docs.github.com/rest/pulls/reviews#submit-a-review-for-a-pull-request).” [!NOTE] To comment on a specific line in a file, you need to first determine the position of that line in the diff. To see a pull request diff, add the ‘application/vnd.github.v3.diff’ media type to the ‘Accept’ header of a call to the Get a pull request (https://docs.github.com/rest/pulls/pulls#get-a-pull-request) endpoint.

The ‘position’ value equals the number of lines down from the first “@@” hunk header in the file you want to add a comment. The line just below the “@@” line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.

This endpoint supports the following custom media types. For more information, see “Media types (https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types).”

  • ‘application/vnd.github-commitcomment.raw+json’: Returns the raw markdown body. Response will include ‘body’. This is the default if you do not pass any specific media type.
  • ‘application/vnd.github-commitcomment.text+json’: Returns a text only representation of the markdown body. Response will include ‘body_text’.
  • ‘application/vnd.github-commitcomment.html+json’: Returns HTML rendered from the body’s markdown. Response will include ‘body_html’.
  • ‘application/vnd.github-commitcomment.full+json’: Returns raw, text, and HTML representations. Response will include ‘body’, ‘body_text’, and ‘body_html’.

Endpoint: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews API version: 2026-03-10

EXAMPLES

EXAMPLE 1

New-GitHubPullRequestReview -Owner 'octocat' -Repo 'Hello-World' -PullNumber 1

Invokes POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews

EXAMPLE 2

New-GitHubPullRequestReview -Owner 'octocat' -Repo 'Hello-World' -PullNumber 1 -Body @{ commit_id = 'ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091' }

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: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-BodyEvent

The review action you want to perform. The review actions include: ‘APPROVE’, ‘REQUEST_CHANGES’, or ‘COMMENT’. By leaving this blank, you set the review action state to ‘PENDING’, which means you will need to submit the pull request review (https://docs.github.com/rest/pulls/reviews#submit-a-review-for-a-pull-request) when you are ready.

Body property [ event ]

Allowed values: ‘APPROVE’, ‘REQUEST_CHANGES’, ‘COMMENT’

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

-BodyText

Required when using ‘REQUEST_CHANGES’ or ‘COMMENT’ for the ‘event’ parameter. The body text of the pull request review.

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: ''

-Comments

Use the following table to specify the location, destination, and contents of the draft review comment.

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

-CommitId

The SHA of the commit that needs a review. Not using the latest commit SHA may render your review comment outdated if a subsequent commit modifies the line you specify as the ‘position’. Defaults to the most recent commit in the pull request when you do not specify a value.

Body property [ commit_id ]

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: ''

-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: ''

-PullNumber

The number that identifies the pull request.

Path parameter [ pull_number ]

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: ''

-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: ''

-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: pulls/create-review Category: pulls / reviews