Improve your code review process by automating comments to avoid common mistakes or remind the developer of possible dependencies outside the pull request.
Setting up the task
Install the extension in your collection and create a pipeline. Add the PrCommentator task to the YAML file and configure the inputs as you see fit:
- task: PrCommentator@0
comment: 'Files in /foo/ should only be auto-generated. Did you update /foo-generator.json first?'
This will generate a comment like the following:
The task supports the following inputs:
A Personal Access Token for the identity used to create the comments. If not specified, the pipeline's build service user is used.
comment: 'The is the text inserted into the comment'
A string with the content of the comment. Markdown is supported.
A glob expression. The pull request must have a file matching the expression for the comment to be added. See supported features.
commitExpr: '^(fix\|feat): #\d+ .*'
A regular expression. The pull request must have at least one commit message that does not match this expression for the comment to be created. NB: no flags are used, which means ^, $ and .does not match newline characters.
Below is a list of coming features and future plans:
Support multiple globs
Support "negative" globs: add comment if no file matching the glob is included in the PR
(Input) Branch name: add a comment based on the source or target branch name
(Input) Auto-resolve: automatically resolve or reopen a comment based on new updates to the PR