-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.45 KB
/
notificar.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
name: Google Chat Notification
on:
push:
branches:
- '*'
jobs:
send_notification:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Extract commit information
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
AUTHOR=$(git log -1 --pretty=format:'%an')
BRANCH=$(echo ${{ github.ref }} | awk -F'/' '{print $NF}')
ISSUE_TEXT=""
if [[ $COMMIT_MESSAGE =~ \#([0-9]+) ]]; then
ISSUE_NUMBER="${BASH_REMATCH[1]}"
ISSUE_TEXT="<font color='#00FF00'><b>issue #$ISSUE_NUMBER</b></font>"
fi
MESSAGE="<b><font color='#0000FF'>$AUTHOR</font></b> subió cambios en el $ISSUE_TEXT en la rama <b>$BRANCH</b>"
curl -X POST -H 'Content-Type: application/json' -d '{
"cards": [
{
"header": {
"title": "Notificación de GitHub",
"subtitle": "Cambio en el repositorio"
},
"sections": [
{
"widgets": [
{
"textParagraph": {
"text": "'"$MESSAGE"'"
}
}
]
}
]
}
]
}' "$CHAT_WEBHOOK_URL"
env:
CHAT_WEBHOOK_URL: ${{ secrets.CHAT_WEBHOOK_URL }}