Skip to content

Commit 89c87e4

Browse files
authored
Separate push notification from pull request (google#152)
1 parent 48e2e68 commit 89c87e4

File tree

2 files changed

+60
-4
lines changed

2 files changed

+60
-4
lines changed
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ name: GSI Chatroom PR Notification
33
on:
44
pull_request:
55
types: [assigned, opened, ready_for_review, reopened, review_requested]
6-
push:
7-
branches:
8-
- main
9-
106

117
jobs:
128
notify:
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
jobs:
7+
notify:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Main Branch Push
11+
run: |
12+
echo "Pushing commit to main: ${{ github.event.push.head_commit.id }}"
13+
echo "Pushed by: ${{ github.event.push.pusher.name }}"
14+
15+
- name: Push Notification to Google Chat
16+
run: |
17+
curl --location --request POST '${{ secrets.WEBHOOK_URL }}' \
18+
--header 'Content-Type: application/json' \
19+
--data-raw '{
20+
"cards": [
21+
{
22+
"header": {
23+
"title": "Push to main branch",
24+
"subtitle": "${{ github.event.push.head_commit.message }}"
25+
},
26+
"sections": [
27+
{
28+
"widgets": [
29+
{
30+
"keyValue": {
31+
"topLabel": "Repo",
32+
"content": "${{ github.event.push.repository.name }}"
33+
}
34+
},
35+
{
36+
"keyValue": {
37+
"topLabel": "Committed by",
38+
"content": "Committed by: ${{ github.event.push.head_commit.committer.username }}"
39+
}
40+
},
41+
{
42+
"buttons": [
43+
{
44+
"textButton": {
45+
"text": "Ref comparison",
46+
"onClick": {
47+
"openLink": {
48+
"url": "${{ github.event.push.compare }}"
49+
}
50+
}
51+
}
52+
}
53+
]
54+
}
55+
]
56+
}
57+
]
58+
}
59+
]
60+
}'

0 commit comments

Comments
 (0)