From 6ee19bac554c61e650fd3faef62566374cc1423c Mon Sep 17 00:00:00 2001 From: ohemorange Date: Mon, 23 Jun 2025 10:08:21 -0700 Subject: [PATCH] Allow notification of two reviewers being assigned to a PR and two issue assignees (#10345) Fixes https://github.com/certbot/certbot/issues/10344 You can see this working in the mattermost "Test" channel, where I ran this code from my test repo. The documentation for the PR reviewer syntax is here: https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=review_requested#pull_request We now no longer notify on PR assignees. But I think that is the correct behavior. This PR also fixes a bug in the issue assigned notification code, and now lets you see when two different people were assigned. That documentation is here: https://docs.github.com/en/webhooks/webhook-events-and-payloads# After this is in, I'll make the same changes to the josepy repo. You can see the `if` syntax here: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows ``` on: pull_request: types: [review_requested] jobs: specific_review_requested: runs-on: ubuntu-latest if: ${{ github.event.requested_team.name == 'octo-team'}} steps: - run: echo 'A review from octo-team was requested' ``` --------- Co-authored-by: Brad Warren --- .github/workflows/assigned.yaml | 5 +---- .github/workflows/review_requested.yaml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/review_requested.yaml diff --git a/.github/workflows/assigned.yaml b/.github/workflows/assigned.yaml index 91b453423..f365067ce 100644 --- a/.github/workflows/assigned.yaml +++ b/.github/workflows/assigned.yaml @@ -3,9 +3,6 @@ name: Issue Assigned on: issues: types: [assigned] - - pull_request_target: - types: [assigned] jobs: send-mattermost-message: runs-on: ubuntu-latest @@ -14,4 +11,4 @@ jobs: with: MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_ASSIGN_WEBHOOK }} TEXT: > - ${{ github.event.issue.assignee.login || github.event.pull_request.assignee.login }} assigned to "${{ github.event.issue.title || github.event.pull_request.title }}": ${{ github.event.issue.html_url || github.event.pull_request.html_url }} + ${{ github.event.assignee.login }} assigned to "${{ github.event.issue.title }}": ${{ github.event.issue.html_url }} diff --git a/.github/workflows/review_requested.yaml b/.github/workflows/review_requested.yaml new file mode 100644 index 000000000..1d71acba7 --- /dev/null +++ b/.github/workflows/review_requested.yaml @@ -0,0 +1,16 @@ +name: Review Requested + +on: + pull_request_target: + types: [review_requested] +jobs: + send-mattermost-message: + # Don't notify for the interim step of certbot/eff-devs being assigned + if: ${{ github.event.requested_reviewer.login != ''}} + runs-on: ubuntu-latest + steps: + - uses: mattermost/action-mattermost-notify@master + with: + MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_ASSIGN_WEBHOOK }} + TEXT: > + Review requested from ${{ github.event.requested_reviewer.login }} for "${{ github.event.pull_request.title }}": ${{ github.event.pull_request.html_url }}