Add new workflow to ping Slack every time a certain team is assigned as PR reviewer or tagged in a PR comment. (#41067)
* Add new workflow to ping Slack every time a certain team is assigned as PR reviewer or tagged in a PR comment. * Fix workflow after getting feedback from review. * Fix test-assistant-pr-review workflow so that it also triggers on PR review comments. * Remove the pull_request trigger from test-assistant-pr-review.yml as it was added only to improve testability.
This commit is contained in:
parent
68e0a6404a
commit
c9b478ce7d
|
@ -0,0 +1,48 @@
|
|||
name: Send PRs that require review to Slack
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [review_requested]
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_review_comment:
|
||||
types: [created]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
send-pr-to-slack-for-review:
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
WOO_PR_TESTING_REVIEW_TEAM: ${{ secrets.WOO_PR_TESTING_REVIEW_TEAM }}
|
||||
steps:
|
||||
- name: Send ping to Slack for a new review
|
||||
uses: archive/github-actions-slack@d9dae40827adf93bddf939db6552d1e392259d7d
|
||||
id: notify-review
|
||||
if: |
|
||||
(github.event_name == 'pull_request' || github.event_name == 'pull_request_target') &&
|
||||
github.event.action == 'review_requested' &&
|
||||
github.event.requested_team.slug == env.WOO_PR_TESTING_REVIEW_TEAM
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.TEST_ASSISTANCE_BOT_TOKEN }}
|
||||
slack-channel: ${{ secrets.WOO_PR_TESTING_REVIEW_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
<!subteam^${{ secrets.WOO_PR_TESTING_REVIEW_TEAM_ID }}> was asked to review this PR:
|
||||
<${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}> :thread:
|
||||
slack-optional-unfurl_links: false
|
||||
slack-optional-unfurl_media: false
|
||||
|
||||
- name: Send ping to Slack about a new comment
|
||||
uses: archive/github-actions-slack@d9dae40827adf93bddf939db6552d1e392259d7d
|
||||
id: notify-comment
|
||||
if: |
|
||||
(github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') &&
|
||||
contains(github.event.comment.body, env.WOO_PR_TESTING_REVIEW_TEAM)
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.TEST_ASSISTANCE_BOT_TOKEN }}
|
||||
slack-channel: ${{ secrets.WOO_PR_TESTING_REVIEW_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
<!subteam^${{ secrets.WOO_PR_TESTING_REVIEW_TEAM_ID }}> was mentioned in a comment:
|
||||
<${{ github.event.comment.html_url }}|${{ github.event.issue.title }}> :speech_balloon:
|
||||
slack-optional-unfurl_links: false
|
||||
slack-optional-unfurl_media: false
|
Loading…
Reference in New Issue