Turn off PR comments if a user is in a specified GitHub team.
This action extends the GitHub Action: EnricoMi/publish-unit-test-result-action to allow you to suppress comments on PRs for users who join a GitHub Team.
It seems that the behaviour to comment PRs when tests fail was quite controversial in my department! Some devs found it really useful, others found it really annoying.
Therefore rather than having to turn off for everyone and some miss out on the value, or turned on for everyone and annoy people this action solves that.
- Set up a new GitHub Team for users to join who want to switch off the comments for their PR
- Add this action
- name: Turn off PR comments for users in 'Suppress PR test summary comments'
uses: eloisetaylor5693/turn-off-pr-comments-for-test-summary-github-action@v2.0.3
id: suppress-pr-comments-for-some-users
with:
default_comment_mode: 'failures'
github_organisation: 'my-org'
github_team_for_switching_off_comments: 'Suppress PR test summary comments'
github_token: ${{ secrets.github_token }}
- Use the
test_summary_comment_mode
output when using EnricoMi/publish-unit-test-result-action
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2.14.0
if: always()
with:
files: *.xml
comment_mode: ${{ steps.suppress-pr-comments-for-some-users.outputs.test_summary_comment_mode }}
check_name: "Tests"
Option | Default Value | Description |
---|---|---|
default_comment_mode |
"failures" | The comment mode to use when a commit author isn't in any GitHub Teams for suppressing comments on the PR. |
github_token |
${{github.token}} |
An alternative GitHub token, other than the default provided by GitHub Actions runner. |
github_team_for_switching_off_comments |
"Suppress PR test summary comments" | GitHub Team users can join to suppress comments on their PR. |
github_organisation |
${{ github.repository_owner }} |
GitHub Organisation the team is part of. |
See available comment_mode
values in the config from EnricoMi/publish-unit-test-result-action.
test_summary_comment_mode
: is either the default you gave for the input default_comment_mode
or off