forked from OpenMDAO/Aviary
-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (132 loc) · 5.22 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
143
144
name: Notify Teams
on:
pull_request_target:
branches: [main]
types: [opened, reopened, assigned, closed]
env:
SMTP_SERVER: smtp.gmail.com
SMTP_PORT: 465
EMAIL_USERNAME: ${{ secrets.EMAIL_USERNAME }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}
EMAIL_FROM: GitHub Actions
EMAIL_TO: ${{ secrets.DESTINATION_EMAIL }}
# Optional priority: 'high', 'normal' (default) or 'low'
jobs:
send_email_on_opened_pr:
if: github.event_name == 'pull_request' && github.event.action == 'opened'
runs-on: ubuntu-latest
steps:
- 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
- name: Send Email on Opened PR
uses: dawidd6/action-send-mail@v3
with:
server_address: ${{ env.SMTP_SERVER }}
server_port: ${{ env.SMTP_PORT }}
username: ${{ env.EMAIL_USERNAME }}
password: ${{ env.EMAIL_PASSWORD }}
to: ${{ env.EMAIL_TO }}
from: ${{ env.EMAIL_FROM }}
subject: "***Notification*** New Pull Request: ${{ env.number }}"
body: |
{
"action": "${{ env.action }}",
"number": "${{ env.number }}",
"user": "${{ env.user }}",
"title": "${{ env.title }}",
"url": "${{ env.url }}",
"assignees": "${{ env.assignees }}"
}
ignore_cert: true
nodemailerlog: true
nodemailerdebug: true
send_email_on_reopened_pr:
if: github.event_name == 'pull_request' && github.event.action == 'reopened'
runs-on: ubuntu-latest
steps:
- 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
- name: Send Email on Reopened PR
uses: dawidd6/action-send-mail@v3
with:
server_address: ${{ env.SMTP_SERVER }}
server_port: ${{ env.SMTP_PORT }}
username: ${{ env.EMAIL_USERNAME }}
password: ${{ env.EMAIL_PASSWORD }}
to: ${{ env.EMAIL_TO }}
from: ${{ env.EMAIL_FROM }}
subject: "***Notification*** Reopened: ${{ env.number }}"
body: |
{
"action": "${{ env.action }}",
"number": "${{ env.number }}",
"user": "${{ env.user }}",
"title": "${{ env.title }}"
}
ignore_cert: true
nodemailerlog: true
nodemailerdebug: true
send_email_on_updated_assignees:
if: github.event_name == 'pull_request' && github.event.action == 'assigned'
runs-on: ubuntu-latest
steps:
- 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: dawidd6/action-send-mail@v3
with:
server_address: ${{ env.SMTP_SERVER }}
server_port: ${{ env.SMTP_PORT }}
username: ${{ env.EMAIL_USERNAME }}
password: ${{ env.EMAIL_PASSWORD }}
to: ${{ env.EMAIL_TO }}
from: ${{ env.EMAIL_FROM }}
subject: "***Notification*** Updated Assignees for Pull Request: ${{ env.number }}"
body: |
{
"number": "${{ env.number }}",
"assignees": "${{ env.assignees }}",
"title": "${{ env.title }}"
}
ignore_cert: true
nodemailerlog: true
nodemailerdebug: true
send_email_on_closed_pr:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- 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 Updated Assignees
uses: dawidd6/action-send-mail@v3
with:
server_address: ${{ env.SMTP_SERVER }}
server_port: ${{ env.SMTP_PORT }}
username: ${{ env.EMAIL_USERNAME }}
password: ${{ env.EMAIL_PASSWORD }}
to: ${{ env.EMAIL_TO }}
from: ${{ env.EMAIL_FROM }}
subject: "***Notification*** Closed Pull Request: ${{ env.number }}"
body: |
{
"number": "${{ env.number }}",
"title": "${{ env.title }}"
}
ignore_cert: true
nodemailerlog: true
nodemailerdebug: true