aaaaaaaaaa

This commit is contained in:
Grol Grol 2025-03-13 21:29:47 +03:00
parent e327252c3f
commit 23e52e6cd6

View file

@ -19,30 +19,9 @@ jobs:
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 }}"
escape_markdown_v2() {
echo "$1" | sed -e 's/[_*\[\]()~`>#+\-=|{}.!]/\\&/g'
}
SAFE_REPO=$(escape_markdown_v2 "$REPO")
SAFE_EVENT=$(escape_markdown_v2 "$EVENT_TYPE")
SAFE_ACTION=$(escape_markdown_v2 "$ACTION")
SAFE_TITLE=$(escape_markdown_v2 "$TITLE")
SAFE_URL=$(escape_markdown_v2 "$URL")
TEXT="*Событие в ${SAFE_REPO}*
Тип: \`${SAFE_EVENT}\`
Действие: \`${SAFE_ACTION}\`
Заголовок: \`${SAFE_TITLE}\`
[Открыть](${SAFE_URL})"
MESSAGE="Событие в *${{ github.repository }}*:\nТип: ${{ github.event_name }}\nДействие: ${{ github.event.action }}\nЗаголовок: ${{ github.event.issue.title || github.event.pull_request.title || 'Комментарий' }}\n[Открыть](${{ github.event.issue.html_url || github.event.pull_request.html_url || github.event.comment.html_url || github.event.review.html_url }})"
curl -s -X POST \
https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage \
-d chat_id="${TELEGRAM_CHAT_ID}" \
-d parse_mode=MarkdownV2 \
-d text="${TEXT}"
-d chat_id=${TELEGRAM_CHAT_ID} \
-d parse_mode=Markdown \
-d "text=${MESSAGE}"