Update tg_notify.yml

This commit is contained in:
grol 2025-05-12 11:57:22 +03:00 committed by GitHub
parent da1168d343
commit 4f70f30987
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,19 +11,37 @@ on:
types: [submitted]
jobs:
build:
name: Build
notify:
runs-on: ubuntu-latest
steps:
- name: send telegram message on push
- name: Create message file
run: |
TITLE="${{ github.event.issue.title || github.event.pull_request.title || 'Комментарий' }}"
COMMENT="${{ github.event.comment.body || '' }}"
MSG="Repository: ${{ github.repository }}
Type: ${{ github.event_name }}
Action: ${{ github.event.action }}
Title: ${TITLE}
${COMMENT}
See: ${{ github.event.issue.html_url || github.event.pull_request.html_url || github.event.comment.html_url || github.event.review.html_url }}"
echo "$MSG" > message.txt
LENGTH=$(wc -c < message.txt)
echo "MESSAGE_LENGTH=$LENGTH" >> $GITHUB_ENV
- name: Send full message if short
if: ${{ env.MESSAGE_LENGTH < 4096 }}
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: |
Repository: ${{ github.repository }}
Type: ${{ github.event_name }}
Action: ${{ github.event.action }}
Titile: ${{ github.event.issue.title || github.event.pull_request.title || 'Комментарий' }}
${{github.event.comment.body || ''}}
See ${{ github.event.issue.html_url || github.event.pull_request.html_url || github.event.comment.html_url || github.event.review.html_url }}
message_file: message.txt
- name: Send only link if message too long
if: ${{ env.MESSAGE_LENGTH >= 4096 }}
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: |
See: ${{ github.event.issue.html_url || github.event.pull_request.html_url || github.event.comment.html_url || github.event.review.html_url }}