Skip to content

Commit f934ec5

Browse files
authored
Create announcement.yml
1 parent eaec2c7 commit f934ec5

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/announcement.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Notify Telegram on Release Merge
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches: [main]
7+
8+
jobs:
9+
telegram:
10+
if: github.event.pull_request.merged == true
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Extract Release Notes
15+
id: extract
16+
run: |
17+
BODY="${{ github.event.pull_request.body }}"
18+
19+
# Extract from "# Releases" onward
20+
RELEASE_NOTES=$(echo "$BODY" | awk '/^# Releases/{flag=1} flag')
21+
22+
# Escape backticks to prevent breaking Telegram message
23+
RELEASE_NOTES="${RELEASE_NOTES//\`/\\\`}"
24+
25+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
26+
echo "$RELEASE_NOTES" >> $GITHUB_ENV
27+
echo "EOF" >> $GITHUB_ENV
28+
29+
- name: Send Telegram Message
30+
uses: appleboy/telegram-action@master
31+
with:
32+
to: ${{ secrets.TELEGRAM_TO }}
33+
token: ${{ secrets.TELEGRAM_TOKEN }}
34+
message: |
35+
✅ **Release Merged to Main**
36+
🔗 [PR #${{ github.event.pull_request.number }}](${{ github.event.pull_request.html_url }})
37+
👤 Author: [${{ github.event.pull_request.user.login }}](https://github.com/${{ github.event.pull_request.user.login }})
38+
39+
📦 **Release Notes:**
40+
```
41+
${{ env.RELEASE_NOTES }}
42+
```

0 commit comments

Comments
 (0)