Skip to content

con nombre de repo #1 #18

con nombre de repo #1

con nombre de repo #1 #18

Workflow file for this run

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}')
REPO_NAME=$(echo ${{ github.repository }} | 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 $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: '"$REPO_NAME"'"
},
"sections": [
{
"widgets": [
{
"textParagraph": {
"text": "'"$MESSAGE"'"
}
}
]
}
]
}
]
}' "$CHAT_WEBHOOK_URL"
env:
CHAT_WEBHOOK_URL: ${{ secrets.CHAT_WEBHOOK_URL }}