An easy way to automatically add comments to an Azure DevOps pull request
More information about this extension on the Visual Studio Marketplace
Sometimes there are things a team would like developers to consider during a pull request. Putting these in the description can help but is easily overlooked or ignored.
By automatically adding comments to the PR, this puts the owner in control of acknowledging and responding to each item. If used with a branch policy that enforces comment resolution, it can also help enforce certain team policies that are difficult to automate
Here are some examples:
Add the task into your pull request build:
steps:
- task: pr-auto-comment@1
inputs:
comments: |
Has this been tested in the dev environment?
Does the documentation need to be updated due to this change?
If you are using the System.AccessToken
(default), be sure to set persistCredentials
to true
if it's not already:
steps:
- checkout: self
persistCredentials: true
By default, text separated by a new line (\n
) is treated as a separate comment. To use a different comment delimiter, set newCommentDelimiter
:
steps:
- task: pr-auto-comment@1
inputs:
newCommentDelimiter: "||"
comments: |
This is the first comment ||
This is a second comment
This is second line of the second comment ||
This is a third comment
Contribute to pull requests
permission to allow it to add pull request comments. More information here.Property | Required | Default Value | Description |
---|---|---|---|
accessToken |
Yes | $(System.AccessToken) |
The access token used to retrieve and update comments on the pull requests |
comments |
Yes | Comments, separated by newCommentDelimiter , that should be added to each PR. |
|
newCommentDelimiter |
Yes | \n (newline) |
New comment delimiter to differentiate between separate comments |
Found an issue or see something cool that's missing? Pull requests and issues are warmly accepted!