Comment on pull requests
With Reviewpad, you can automatically add comments to the pull request.
There are three different mechanisms to add a comment to the pull request:
- Using the
comment
action. - Using the
commentOnce
action. - Using the
error
,info
orwarn
actions.
The difference between the modes is that the comment
action will add a comment every time the action is executed, commentOnce
will add a comment once no matter the amount of times the action is executed, while the other commenting actions are bundled together in a report comment which is also automatically updated.
Automatically comment on the pull request
reviewpad.yml
rules:
- name: empty-description
spec: $description() == ""
- name: is-first-time-contributor
spec: $pullRequestCountBy($author()) == 1
workflows:
- name: welcome-user
if:
- rule: is-first-time-contributor
then:
- $commentOnce("Well done! This is your first contribution.")
- name: comment-on-empty-description
if:
- rule: empty-description
then:
- $error("The description of the pull request cannot be empty.")
- name: comment-on-pull-request
description: Example comment on pull request
if:
- $description() != ""
then:
- $info("Thanks for this pull request!")
- $warn("Please make sure the CI is green before merging.")