-
Notifications
You must be signed in to change notification settings - Fork 140
40 lines (36 loc) · 1.37 KB
/
notifications.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
name: Dispatch Status Change Notifications (discord and email)
permissions:
contents: read
actions: write
on:
push:
branches:
- main
jobs:
DispatchNotifications:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get status changes and hipnames then dispatch jobs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
arrayOfFiles=()
while IFS= read -r; do
arrayOfFiles+=("${REPLY}")
done < <(git diff HEAD~1..HEAD -G'status:' --name-only | grep .md)
arrayOfStatuses=()
while IFS= read -r; do
arrayOfStatuses+=("${REPLY}")
done < <(git diff HEAD~1..HEAD -G'status:' | egrep "^\+status:" | cut -d ":" -f2)
for ((i=0; i<${#arrayOfFiles[@]}; i++)); do
echo "Initiating Discord workflow"
gh workflow run send-discord-message.yml -f "filename=$(basename ${arrayOfFiles[$i]} .md)" -f "status=${arrayOfStatuses[$i]}"
if [[ ${arrayOfStatuses[$i]} == " Last Call" ]]; then
echo "Initiating Last Call workflow"
gh workflow run send-email.yml -f "filename=$(basename ${arrayOfFiles[$i]} .md)" -f "status=Last Call"
fi
done