Skip to content

Update announcement.yml #13

Update announcement.yml

Update announcement.yml #13

Workflow file for this run

name: Notify Telegram on Release Merge
on:
pull_request:
types: [closed]
branches: [main]
jobs:
telegram:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Extract released packages
id: extract
run: |
REPO="https://github.com/${{ github.repository }}"
echo "${{ github.event.pull_request.body }}" > pr_body.md
# Extract all lines starting with '## '
grep '^## ' pr_body.md | sed 's/^## //' > packages.txt
# Generate HTML list of links to releases
while read -r line; do
ENCODED_TAG=$(echo "$line" | jq -sRr @uri) # encode the tag for URL safety
echo " • <a href=\"$REPO/releases/tag/$ENCODED_TAG\">$line</a>"
done < packages.txt > release_links.html
{
echo "RELEASE_LINKS<<EOF"
cat release_links.html
echo "EOF"
} >> "$GITHUB_ENV"
- name: Send Telegram Message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: html
message: |
🚀 <b>New Release for <a href="https://github.com/${{ github.repository }}"><code>${{ github.repository }}</code></a>!</b>
🔗 View PR: <a href="${{ github.event.pull_request.html_url }}"><b>${{ github.event.pull_request.title }}</b>#${{ github.event.pull_request.number }}</a>
📦 <b>Released Packages:</b>
${{ env.RELEASE_LINKS }}