增加 罗翔法律思维课|谈刑论道喜马拉雅VIP专辑(法考必听+刑法案例解析) #10
This file contains hidden or 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: Notify Multiple Telegram Chats on GitHub Push | |
| description: | | |
| This GitHub Action sends a notification to multiple Telegram chats whenever there is a push to the main branch. | |
| It uses the Telegram Bot API to send messages. | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| notify: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send commit message to multiple Telegram chats | |
| env: | |
| BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
| CHAT_IDS: ${{ secrets.TELEGRAM_CHAT_IDS }} | |
| run: | | |
| echo "BOT_TOKEN: $BOT_TOKEN" | |
| echo "CHAT_IDS: $CHAT_IDS" | |
| IFS=',' read -ra IDS <<< "$CHAT_IDS" | |
| for chat in "${IDS[@]}"; do | |
| response=$(curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \ | |
| -d chat_id="$chat" \ | |
| --data-urlencode "text= | |
| 📝 新增资源: ${{ github.event.head_commit.message }} | |
| 🔗 查看详情: ${{ github.event.head_commit.url }}") | |
| echo "Telegram response for chat_id $chat: $response" | |
| done | |