Tui log bug thử nha #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Notification" | |
on: | |
issues: | |
types: [opened, reopened] | |
jobs: | |
meme: | |
name: Generate Message And Send To Telegram | |
runs-on: ubuntu-latest | |
env: | |
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
TELEGRAM_CHAT_ID: ${{ vars.TELEGRAM_CHAT_ID }} | |
TELEGRAM_TOPIC_ID: ${{ vars.TELEGRAM_TOPIC_ID }} # If you're using a topic in Telegram | |
steps: | |
- name: Generate message | |
run: | | |
ISSUE_TITLE="${{ github.event.issue.title }}" | |
ISSUE_BODY="${{ github.event.issue.body }}" | |
ISSUE_URL="${{ github.event.issue.html_url }}" | |
ISSUE_AUTHOR="${{ github.event.issue.user.login }}" | |
# Properly format the message for Telegram with real newlines | |
MESSAGE=$'🆕 *Bug mới được tạo!*\n\n*Tiêu đề*: '"$ISSUE_TITLE"$'\n\n*Mô tả*:\n\n'"$ISSUE_BODY"$'\n\n*Tác giả*: '"$ISSUE_AUTHOR"$'\n\n[Xem sự cố]('"$ISSUE_URL"$')' | |
echo "$MESSAGE" > message.txt | |
- name: Send Message to Telegram | |
run: | | |
MESSAGE=$(cat message.txt) | |
curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_TOKEN/sendMessage" \ | |
-d chat_id=$TELEGRAM_CHAT_ID \ | |
-d message_thread_id=$TELEGRAM_TOPIC_ID \ | |
-d text="$MESSAGE" \ | |
-d parse_mode="Markdown" \ | |
-d disable_web_page_preview=true |