-
Notifications
You must be signed in to change notification settings - Fork 259
73 lines (69 loc) · 2.28 KB
/
push_notification.yml
File metadata and controls
73 lines (69 loc) · 2.28 KB
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
name: GSI Push Main Notification
on:
push:
branches:
- main
jobs:
notify-push-main:
runs-on: ubuntu-latest
env:
COMMIT: ${{ github.event.head_commit.message }}
steps:
- name: Main Branch Push
run: |
echo "Workflow initiated by event with name: ${{ github.event_name }}"
echo "Pushing commit to main: ${GITHUB_EVENT_HEAD_COMMIT_ID}"
echo "Pushed by: ${GITHUB_EVENT_PUSHER_NAME}"
env:
GITHUB_EVENT_HEAD_COMMIT_ID: ${{ github.event.head_commit.id }}
GITHUB_EVENT_PUSHER_NAME: ${{ github.event.pusher.name }}
- name: Push Notification to Google Chat
run: |
curl --location --request POST '${{ secrets.WEBHOOK_URL }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"cards": [
{
"header": {
"title": "Push to main branch",
"subtitle": "'"$COMMIT"'"
},
"sections": [
{
"widgets": [
{
"keyValue": {
"topLabel": "Repo",
"content": "${GITHUB_EVENT_REPOSITORY_FULL_NAME}"
}
},
{
"keyValue": {
"topLabel": "Committed by",
"content": "${GITHUB_EVENT_HEAD_COMMIT_AUTHOR_USERNAME}"
}
},
{
"buttons": [
{
"textButton": {
"text": "Ref comparison",
"onClick": {
"openLink": {
"url": "${GITHUB_EVENT_COMPARE}"
}
}
}
}
]
}
]
}
]
}
]
}'
env:
GITHUB_EVENT_REPOSITORY_FULL_NAME: ${{ github.event.repository.full_name }}
GITHUB_EVENT_HEAD_COMMIT_AUTHOR_USERNAME: ${{ github.event.head_commit.author.username }}
GITHUB_EVENT_COMPARE: ${{ github.event.compare }}