Merge pull request #1708 from weblate/weblate-rethink-dns-firewall-an… #198
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Notify | |
permissions: | |
contents: read | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
notify: | |
name: Notify via Telegram | |
runs-on: ubuntu-latest | |
env: | |
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHANNEL_ID }} | |
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
steps: | |
- name: Notify | |
if: env.TELEGRAM_CHAT_ID && env.TELEGRAM_TOKEN | |
env: | |
COMMITS: ${{ toJson(github.event.commits) }} | |
TEMPLATE: '.[] | "<a href=\"\(.url)\">\(.id[:8])</a> • <a href=\"https://github.com/\(.author.username | @html)\">\(.author.username | @html)</a> | |
\(.message | gsub("(?<a>[<>&\"])"; .a|@html)) | |
"' | |
run: | | |
( | |
printenv COMMITS | jq -r "$TEMPLATE" | |
printf '@RethinkDNS_Channel' | |
) | \ | |
jq -R --slurp '{ | |
text: ., | |
disable_web_page_preview: true, | |
chat_id: "$TELEGRAM_CHAT_ID", | |
parse_mode: "HTML" | |
}' | \ | |
curl -X POST https://api.telegram.org/bot$TELEGRAM_TOKEN/sendMessage \ | |
-H 'Content-Type: application/json' \ | |
--data-binary @- |