From fa34fb118ab193e9208796ec90d7a1465efc96c1 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Wed, 7 Feb 2024 11:25:32 -0800 Subject: [PATCH 1/4] Added reviewers when PR is opened --- .github/workflows/notify_teams.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/notify_teams.yml b/.github/workflows/notify_teams.yml index 235d0e915..19218a90c 100644 --- a/.github/workflows/notify_teams.yml +++ b/.github/workflows/notify_teams.yml @@ -27,6 +27,12 @@ jobs: echo "title=${{ github.event.pull_request.title }}" >> $GITHUB_ENV echo "url=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV echo "assignees=${{ join(github.event.pull_request.assignees.*.login, ',') }}" >> $GITHUB_ENV + reviewers_list=() + for review in ${{ github.event.pull_request.reviews }}; + do + reviewers_list+=([$review.user.login, $review.state]) + done + echo "::set-output name=reviewers_list::${reviewers_list[@]}" - name: Send Email on Opened PR uses: dawidd6/action-send-mail@v3 @@ -45,7 +51,8 @@ jobs: "user": "${{ env.user }}", "title": "${{ env.title }}", "url": "${{ env.url }}", - "assignees": "${{ env.assignees }}" + "assignees": "${{ env.assignees }}", + "reviewers": "${{ env.reviewers_list}}" } ignore_cert: true nodemailerlog: true From fc9d79e4fe1a36ee4fe5d9db4bda512bb9dd9b0e Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Wed, 14 Feb 2024 12:05:33 -0800 Subject: [PATCH 2/4] added logic for draft PRs --- .github/workflows/notify_teams.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/notify_teams.yml b/.github/workflows/notify_teams.yml index 19218a90c..18efbcfff 100644 --- a/.github/workflows/notify_teams.yml +++ b/.github/workflows/notify_teams.yml @@ -1,6 +1,7 @@ name: Notify Teams on: + # Could also include pull_request pull_request_target: branches: [main] types: [opened, reopened, assigned, closed] @@ -16,7 +17,7 @@ env: jobs: send_email_on_opened_pr: - if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && (github.event.action == 'opened' || github.event.action == 'reopened') + if: github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'ready_for_review' runs-on: ubuntu-latest steps: - name: Get PR Data @@ -59,7 +60,7 @@ jobs: nodemailerdebug: true send_email_on_updated_assignees: - if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'assigned' + if: github.event.action == 'assigned' runs-on: ubuntu-latest steps: - name: Get Updated Assignees @@ -89,7 +90,7 @@ jobs: nodemailerdebug: true send_email_on_closed_pr: - if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'closed' + if: github.event.action == 'closed' || github.event.action == 'converted_to_draft' runs-on: ubuntu-latest steps: - name: Get PR Data @@ -110,7 +111,8 @@ jobs: body: | { "number": "${{ env.number }}", - "title": "${{ env.title }}" + "title": "${{ env.title }}", + "action": "${{ env.action }}" } ignore_cert: true nodemailerlog: true From 01a61c6a13cf75145c749c979328b4236c210bed Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Wed, 14 Feb 2024 12:08:30 -0800 Subject: [PATCH 3/4] added drafts to types --- .github/workflows/notify_teams.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/notify_teams.yml b/.github/workflows/notify_teams.yml index 18efbcfff..173bcf1d2 100644 --- a/.github/workflows/notify_teams.yml +++ b/.github/workflows/notify_teams.yml @@ -4,7 +4,7 @@ on: # Could also include pull_request pull_request_target: branches: [main] - types: [opened, reopened, assigned, closed] + types: [opened, reopened, assigned, closed, ready_for_review, converted_to_draft] env: SMTP_SERVER: smtp.gmail.com From 212c537130f2ad8b73b1208d3bcd62f757b55ff0 Mon Sep 17 00:00:00 2001 From: Carl Recine Date: Wed, 14 Feb 2024 12:09:29 -0800 Subject: [PATCH 4/4] missing space --- .github/workflows/notify_teams.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/notify_teams.yml b/.github/workflows/notify_teams.yml index 173bcf1d2..8b1301363 100644 --- a/.github/workflows/notify_teams.yml +++ b/.github/workflows/notify_teams.yml @@ -53,7 +53,7 @@ jobs: "title": "${{ env.title }}", "url": "${{ env.url }}", "assignees": "${{ env.assignees }}", - "reviewers": "${{ env.reviewers_list}}" + "reviewers": "${{ env.reviewers_list }}" } ignore_cert: true nodemailerlog: true