-
Notifications
You must be signed in to change notification settings - Fork 197
96 lines (92 loc) · 4.11 KB
/
issue-notification.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
name: Issue Creation Tracker
on:
issues:
types: [opened, closed, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Determine Issue Status
run: |
if [[ "${{ github.event.action }}" == "opened" ]]; then
echo "status=🟢 Open" >> $GITHUB_ENV
elif [[ "${{ github.event.action }}" == "closed" ]]; then
echo "status=🟣 Closed" >> $GITHUB_ENV
elif [[ "${{ github.event.action }}" == "reopened" ]]; then
echo "status=🔵 Reopened" >> $GITHUB_ENV
else
echo "status_color=⚪ Unknown" >> $GITHUB_ENV
fi
- name: Git Issue Details
run: |
echo "Issue creator: ${{ github.event.issue.user.login }}"
echo "Issue number: ${{ github.event.issue.number }}"
echo "Issue url: ${{ github.event.issue.html_url }}"
echo "Assigned labels: " ${{ join(github.event.issue.labels.*.name) }}
echo "Issue status: ${{ github.event.action }}"
- name: Google Chat Notification
run: |
curl --location --request POST '${{ secrets.NOTIFY_GITHUB_ISSUES }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"cards": [
{
"header": {
"title": "Issue Tracker",
"subtitle": "Issue No: #${{ github.event.issue.number }}"
},
"sections": [
{
"widgets": [
{
"keyValue": {
"topLabel": "Repository",
"content": "${{ github.repository }}"
}
},
{
"keyValue": {
"topLabel": "Creator",
"content": "${{ github.event.issue.user.login }}"
}
},
{
"keyValue": {
"topLabel": "Assigned Labels",
{
"keyValue": {
"topLabel": "Creator",
"content": "${{ github.event.issue.user.login }}"
},
},
{
"keyValue": {
"topLabel": "Assigned Lables",
"content": "- ${{ join(github.event.issue.labels.*.name) }}"
}
},
{
"textParagraph": {
"text": "Status: ${{ env.status }}"
}
},
{
"buttons": [
{
"textButton": {
"text": "OPEN ISSUE",
"onClick": {
"openLink": {
"url": "${{ github.event.issue.html_url }}"
}
}
}
}
]
}
]
}
]
}
]
}'