mirror of
https://github.com/groldsf/obsidian_check_plugin.git
synced 2026-07-22 05:37:48 +00:00
33 lines
No EOL
1.4 KiB
YAML
33 lines
No EOL
1.4 KiB
YAML
name: Notify Telegram on Issues and Pull Requests
|
||
|
||
on:
|
||
issues:
|
||
types: [opened, edited, reopened]
|
||
pull_request:
|
||
types: [opened, edited, reopened, review_requested, ready_for_review, synchronize]
|
||
issue_comment:
|
||
types: [created]
|
||
pull_request_review:
|
||
types: [submitted]
|
||
|
||
jobs:
|
||
notify:
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Send Telegram Notification
|
||
env:
|
||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
|
||
run: |
|
||
REPO="${{ github.repository }}"
|
||
EVENT_TYPE="${{ github.event_name }}"
|
||
ACTION="${{ github.event.action }}"
|
||
TITLE="${{ github.event.issue.title || github.event.pull_request.title || 'Комментарий' }}"
|
||
URL="${{ github.event.issue.html_url || github.event.pull_request.html_url || github.event.comment.html_url || github.event.review.html_url }}"
|
||
SAFE_TITLE=$(echo "$TITLE" | sed 's/`/\\`/g' | sed 's/(/\\(/g' | sed 's/)/\\)/g')
|
||
TEXT="*Событие в ${REPO}*\nТип: \`${EVENT_TYPE}\`\nДействие: \`${ACTION}\`\nЗаголовок: \`${SAFE_TITLE}\`\n[Открыть](${URL})"
|
||
curl -s -X POST \
|
||
https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage \
|
||
-d chat_id=${TELEGRAM_CHAT_ID} \
|
||
-d parse_mode=Markdown \
|
||
-d "text=${TEXT}" |