Improve your code review process by automating comments to avoid common mistakes or remind the developer of possible dependencies outside the pull request.
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
inputs:
comment: 'Files in /foo/ should only be auto-generated. Did you update /foo-generator.json first?'
fileGlob: '/foo/**/*'
This will generate a comment like the following:
The task supports the following inputs:
Input | Example | Description |
---|---|---|
PAT |
PAT: 'abd123' |
A Personal Access Token for the identity used to create the comments. If not specified, the pipeline's build service user is used. |
comment |
comment: 'The is the text inserted into the comment' |
A string with the content of the comment. Markdown is supported. |
fileGlob |
fileGlob: '/foo/**/*.js' |
A glob expression. The pull request must have a file matching the expression for the comment to be added. See supported features. |
commitExpr |
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:
- (Input)
fileGlob
- 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