Files
wgtunnel-android/.github/workflows/notifications.yml
T
2025-10-07 18:18:18 -04:00

34 lines
2.6 KiB
YAML

name: Send Notifications to Telegram and Matrix
on:
issues:
types: [opened, closed]
release:
types: [published]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send to Telegram
env:
MESSAGE: |
${{ github.event_name == 'issues' && github.event.action == 'opened' && format('🆕 New Issue #%s: *%s* by %s\n\n%s\n\n[View Issue](%s)', github.event.issue.number, github.event.issue.title, github.event.issue.user.login, (github.event.issue.body || 'No body provided')[:200], github.event.issue.html_url) ||
github.event_name == 'issues' && github.event.action == 'closed' && format('✅ Issue Closed #%s: *%s* by %s\n\n[View Issue](%s)', github.event.issue.number, github.event.issue.title, github.event.issue.user.login, github.event.issue.html_url) ||
github.event_name == 'release' && github.event.action == 'published' && format('🚀 New Release *%s* (%s)\n\n%s\n\n[View Release](%s)', github.event.release.name, github.event.release.tag_name, (github.event.release.body || 'No notes provided')[:200], github.event.release.html_url) }}
run: |
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage" \
-d chat_id="${{ vars.TELEGRAM_CHAT_ID }}" \
${{ vars.TELEGRAM_THREAD_ID && format('-d message_thread_id=\"%s\"', vars.TELEGRAM_THREAD_ID) || '' }} \
-d parse_mode="Markdown" \
-d text="$MESSAGE"
- name: Send to Matrix
uses: s3krit/matrix-message-action@v0.0.3
with:
room_id: ${{ vars.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
server: ${{ vars.MATRIX_HOMESERVER }}
message: |
${{ github.event_name == 'issues' && github.event.action == 'opened' && format('🆕 New Issue #{0}: **{1}** by {2}\n\n{3}\n\n[View Issue]({4})', github.event.issue.number, github.event.issue.title, github.event.issue.user.login, (github.event.issue.body || 'No body provided')[:200], github.event.issue.html_url) ||
github.event_name == 'issues' && github.event.action == 'closed' && format('✅ Issue Closed #{0}: **{1}** by {2}\n\n[View Issue]({3})', github.event.issue.number, github.event.issue.title, github.event.issue.user.login, github.event.issue.html_url) ||
github.event_name == 'release' && github.event.action == 'published' && format('🚀 New Release **{0}** ({1})\n\n{2}\n\n[View Release]({3})', github.event.release.name, github.event.release.tag_name, (github.event.release.body || 'No notes provided')[:200], github.event.release.html_url) }}