From c9b478ce7d6fb3c831ecb5db1d109720446545e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20L=C3=B3pez=20Ariza?= <45979455+alopezari@users.noreply.github.com> Date: Mon, 27 Nov 2023 21:39:32 +0100 Subject: [PATCH] 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. --- .../workflows/test-assistant-pr-review.yml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/test-assistant-pr-review.yml diff --git a/.github/workflows/test-assistant-pr-review.yml b/.github/workflows/test-assistant-pr-review.yml new file mode 100644 index 00000000000..dc6e8a07e85 --- /dev/null +++ b/.github/workflows/test-assistant-pr-review.yml @@ -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: | + 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: | + 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