mirror of
https://github.com/groldsf/obsidian_check_plugin.git
synced 2026-07-22 05:37:48 +00:00
aaaaaaaaaa
This commit is contained in:
parent
e327252c3f
commit
23e52e6cd6
1 changed files with 4 additions and 25 deletions
29
.github/workflows/tg_notify.yml
vendored
29
.github/workflows/tg_notify.yml
vendored
|
|
@ -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}"
|
||||
Loading…
Reference in a new issue