New-GitHubPullRequestReviewComment
SYNOPSIS
Create a review comment for a pull request
SYNTAX
Default (Default)
New-GitHubPullRequestReviewComment [-Owner] <string> [-Repo] <string> [-PullNumber] <long>
-BodyText <string> -CommitId <string> -Path <string> [-Position <long>] [-Side <string>]
[-Line <long>] [-StartLine <long>] [-StartSide <string>] [-InReplyTo <long>]
[-SubjectType <string>] [-Accept <string>] [-WhatIf] [-Confirm]
Body
New-GitHubPullRequestReviewComment [-Owner] <string> [-Repo] <string> [-PullNumber] <long>
-Body <Object> [-BodyText <string>] [-CommitId <string>] [-Path <string>] [-Position <long>]
[-Side <string>] [-Line <long>] [-StartLine <long>] [-StartSide <string>] [-InReplyTo <long>]
[-SubjectType <string>] [-Accept <string>] [-WhatIf] [-Confirm]
ALIASES
This cmdlet has the following aliases,
- Get-GHNewPullRequestReviewComment
DESCRIPTION
The New-GitHubPullRequestReviewComment cmdlet invokes the POST method of the /repos/{owner}/{repo}/pulls/{pull_number}/comments endpoint (Create a review comment for a pull request)
Creates a review comment on the diff of a specified pull request. To add a regular comment to a pull request timeline, see “Create an issue comment (https://docs.github.com/rest/issues/comments#create-an-issue-comment).”
If your comment applies to more than one line in the pull request diff, you should use the parameters ‘line’, ‘side’, and optionally ‘start_line’ and ‘start_side’ in your request.
The ‘position’ parameter is closing down. If you use ‘position’, the ‘line’, ‘side’, ‘start_line’, and ‘start_side’ parameters are not required.
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).”
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}/comments API version: 2026-03-10
EXAMPLES
EXAMPLE 1
New-GitHubPullRequestReviewComment -Owner 'octocat' -Repo 'Hello-World' -PullNumber 1 -BodyText 'Great stuff!' -CommitId '6dcb09b5b57875f334f61aebed695e2e4193db5e' -Path 'file1.txt' -Body @{ key = 'value' }
Invokes POST /repos/{owner}/{repo}/pulls/{pull_number}/comments
EXAMPLE 2
New-GitHubPullRequestReviewComment -Owner 'octocat' -Repo 'Hello-World' -PullNumber 1 -Body @{ body = 'Great stuff!' }
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
The text of the review comment.
Required unless -Body is used
Body property [ body ]
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: ''
-CommitId
The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the ‘position’.
Required unless -Body is used
Body property [ commit_id ]
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: ''
-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: ''
-InReplyTo
The ID of the review comment to reply to. To find the ID of a review comment with “List review comments on a pull request” (#list-review-comments-on-a-pull-request). When specified, all parameters other than ‘body’ in the request body are ignored.
Body property [ in_reply_to ]
Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Line
Required unless using ‘subject_type:file’. The line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to.
Type: System.Int64
DefaultValue: 0
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: ''
-Path
The relative path to the file that necessitates a comment.
Required unless -Body is used
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: ''
-Position
This parameter is closing down. Use ‘line’ instead. The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. 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 property is deprecated
Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
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: ''
-Side
In a split diff view, the side of the diff that the pull request’s changes appear on. Can be ‘LEFT’ or ‘RIGHT’. Use ‘LEFT’ for deletions that appear in red. Use ‘RIGHT’ for additions that appear in green or unchanged lines that appear in white and are shown for context. For a multi-line comment, side represents whether the last line of the comment range is a deletion or addition. For more information, see “Diff view options (https://docs.github.com/articles/about-comparing-branches-in-pull-requests#diff-view-options)” in the GitHub Help documentation.
Allowed values: ‘LEFT’, ‘RIGHT’
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-StartLine
Required when using multi-line comments unless using ‘in_reply_to’. The ‘start_line’ is the first line in the pull request diff that your multi-line comment applies to. To learn more about multi-line comments, see “Commenting on a pull request (https://docs.github.com/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)” in the GitHub Help documentation.
Body property [ start_line ]
Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-StartSide
Required when using multi-line comments unless using ‘in_reply_to’. The ‘start_side’ is the starting side of the diff that the comment applies to. Can be ‘LEFT’ or ‘RIGHT’. To learn more about multi-line comments, see “Commenting on a pull request (https://docs.github.com/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)” in the GitHub Help documentation. See ‘side’ in this table for additional context.
Body property [ start_side ]
Allowed values: ‘LEFT’, ‘RIGHT’, ‘side’
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-SubjectType
The level at which the comment is targeted.
Body property [ subject_type ]
Allowed values: ‘line’, ‘file’
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: pulls/create-review-comment Category: pulls / comments