-
Notifications
You must be signed in to change notification settings - Fork 68
142 lines (126 loc) · 5.09 KB
/
notify_teams.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Notify Teams
on:
# Could also include pull_request
pull_request_target:
branches: [main]
types: [opened, reopened, assigned, closed, ready_for_review, converted_to_draft, review_requested]
jobs:
send_email_on_opened_pr:
if: github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'ready_for_review'
runs-on: ubuntu-latest
steps:
- name: Checkout actions
uses: actions/checkout@v3
with:
sparse-checkout: |
.github/actions
path: actions
- name: Get PR Data
run: |
echo "action=${{ github.event.action }}" >> $GITHUB_ENV
echo "number=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "user=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
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
echo "reviewers=${{ join(github.event.pull_request.requested_reviewers.*.login, ',') }}" >> $GITHUB_ENV
- name: Send Email on Opened PR
uses: ./actions/.github/actions/send_email
with:
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
to: ${{ secrets.DESTINATION_EMAIL }}
subject: "***Notification*** Opened Pull Request: ${{ env.number }}"
body: |
{
"action": "${{ env.action }}",
"number": "${{ env.number }}",
"user": "${{ env.user }}",
"title": "${{ env.title }}",
"url": "${{ env.url }}",
"assignees": "${{ env.assignees }}",
"reviewers": "${{ env.reviewers }}"
}
send_email_on_updated_assignees:
if: github.event.action == 'assigned'
runs-on: ubuntu-latest
steps:
- name: Checkout actions
uses: actions/checkout@v3
with:
sparse-checkout: |
.github/actions
path: actions
- name: Get Updated Assignees
run: |
echo "number=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "assignees=${{ join(github.event.pull_request.assignees.*.login, ',') }}" >> $GITHUB_ENV
echo "title=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
- name: Send Email on Updated Assignees
uses: ./actions/.github/actions/send_email
with:
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
to: ${{ secrets.DESTINATION_EMAIL }}
subject: "***Notification*** Updated Assignees for Pull Request: ${{ env.number }}"
body: |
{
"number": "${{ env.number }}",
"assignees": "${{ env.assignees }}",
"title": "${{ env.title }}"
}
send_email_on_review_request:
if: github.event.action == 'review_requested'
runs-on: ubuntu-latest
steps:
- name: Checkout actions
uses: actions/checkout@v3
with:
sparse-checkout: |
.github/actions
path: actions
- name: Get Reviewers
run: |
echo "number=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "reviewers=${{ join(github.event.pull_request.requested_reviewers.*.login, ',') }}" >> $GITHUB_ENV
echo "title=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
- name: Send Email on Reviewer Requested
uses: ./actions/.github/actions/send_email
with:
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
to: ${{ secrets.DESTINATION_EMAIL }}
subject: "***Notification*** Updated Reviewers for Pull Request: ${{ env.number }}"
body: |
{
"number": "${{ env.number }}",
"reviewers": "${{ env.reviewers }}",
"title": "${{ env.title }}"
}
send_email_on_closed_pr:
if: github.event.action == 'closed' || github.event.action == 'converted_to_draft'
runs-on: ubuntu-latest
steps:
- name: Checkout actions
uses: actions/checkout@v3
with:
sparse-checkout: |
.github/actions
path: actions
- name: Get PR Data
run: |
echo "number=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "title=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
- name: Send Email on Closed PR
uses: ./actions/.github/actions/send_email
with:
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
to: ${{ secrets.DESTINATION_EMAIL }}
subject: "***Notification*** Closed Pull Request: ${{ env.number }}"
body: |
{
"number": "${{ env.number }}",
"title": "${{ env.title }}",
"action": "${{ env.action }}"
}