-
Notifications
You must be signed in to change notification settings - Fork 863
Add Telegram Notifier to Nightly CI pipeline #1934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
UnschooledGamer
merged 18 commits into
Acode-Foundation:main
from
UnschooledGamer:UnschooledGamer-patch-1
Mar 9, 2026
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4070b34
chore: message type detection in release notes script
UnschooledGamer f37982c
Remove redundant check for message prefix
UnschooledGamer 6304f5a
update: community-release-notifier with Telegram support
UnschooledGamer 7b5553f
Merge pull request #12 from UnschooledGamer/UnschooledGamer-patch-1-1
UnschooledGamer 2da06c5
Merge branch 'Acode-Foundation:UnschooledGamer-patch-1' into Unschool…
UnschooledGamer 800135d
Update Telegram action in workflow file
UnschooledGamer 5837e13
Refactor release variables for safety and clarity
UnschooledGamer c5828d6
Update .github/workflows/community-release-notifier.yml
UnschooledGamer 72e1f2f
Update .github/workflows/community-release-notifier.yml
UnschooledGamer 9051f44
chore: enhance community release notifier with delimiter
UnschooledGamer 3c783f6
Update .github/workflows/community-release-notifier.yml
UnschooledGamer 4c397d5
Update .github/workflows/community-release-notifier.yml
UnschooledGamer 67cb0a2
Update .github/workflows/community-release-notifier.yml
UnschooledGamer 4fc3f05
Update community-release-notifier.yml
UnschooledGamer 60e7bab
Update community-release-notifier.yml
UnschooledGamer c57a866
Update .github/workflows/community-release-notifier.yml
UnschooledGamer 6710bc5
Update community-release-notifier.yml
UnschooledGamer 5d852f2
chore: fix telegram creds requirements
UnschooledGamer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,125 @@ | ||
| name: community-release-notifier | ||
|
|
||
| on: | ||
| release: | ||
| types: [ released ] | ||
| workflow_call: | ||
| inputs: | ||
| tag_name: | ||
| required: true | ||
| description: "Release tag_name" | ||
| type: 'string' | ||
| url: | ||
| required: true | ||
| description: "release URL" | ||
| type: 'string' | ||
| body: | ||
| required: true | ||
| description: "Release Body" | ||
| type: 'string' | ||
| default: '' | ||
| tag_name: | ||
| required: true | ||
| description: "Release tag_name" | ||
| type: 'string' | ||
| url: | ||
| required: true | ||
| description: "release URL" | ||
| type: 'string' | ||
| body: | ||
| required: true | ||
| description: "Release Body" | ||
| type: 'string' | ||
| default: '' | ||
| secrets: | ||
| DISCORD_WEBHOOK_RELEASE_NOTES: | ||
| description: 'Discord Webhook for Notifying Releases to Discord' | ||
| required: true | ||
| TELEGRAM_BOT_TOKEN: | ||
| description: 'Telegram Bot Token' | ||
| required: true | ||
| TELEGRAM_CHAT_ID: | ||
| description: 'Telegram Chat ID (group/channel/supergroup)' | ||
| required: true | ||
| TELEGRAM_MESSAGE_THREAD_ID: | ||
| description: 'Topic / message_thread_id for Telegram forum/topic' | ||
| required: true | ||
|
|
||
| jobs: | ||
| discord-release: | ||
| notify: | ||
| if: github.repository_owner == 'Acode-Foundation' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Get Release Content | ||
| id: get-release-content | ||
| uses: 2428392/gh-truncate-string-action@b3ff790d21cf42af3ca7579146eedb93c8fb0757 # v1.4.1 | ||
| with: | ||
| maxLength: 2000 | ||
| stringToTruncate: | | ||
| 📢 Acode [${{ github.event.release.tag_name || inputs.tag_name }}](<${{ github.event.release.url || inputs.url }}>) was just Released 🎉! | ||
| - name: Prepare release variables | ||
| id: vars | ||
| env: | ||
| INPUT_TAG: ${{ github.event.release.tag_name || inputs.tag_name }} | ||
| INPUT_URL: ${{ github.event.release.url || inputs.url }} | ||
| INPUT_BODY: ${{ github.event.release.body || inputs.body }} | ||
| run: | | ||
| TAG="$INPUT_TAG" | ||
| URL="$INPUT_URL" | ||
|
|
||
| # Generate a random delimiter (hex string, safe and collision-resistant) | ||
| DELIMITER=$(openssl rand -hex 16 || head -c 16 /dev/urandom | xxd -p -c 16) | ||
|
|
||
| ${{ github.event.release.body || inputs.body }} | ||
| # Escape problematic characters for MarkdownV2 (very conservative escaping) | ||
| # We escape: _ * [ ] ( ) ~ ` > # + - = | { } . ! \ | ||
| BODY_SAFE=$(printf '%s' "$INPUT_BODY" | \ | ||
| sed 's/[_*[\]()~`>#+=|{}.!\\-]/\\&/g') | ||
| TAG_SAFE=$(printf '%s' "$TAG" | sed 's/[_*[\]()~`>#+=|{}.!\\-]/\\&/g') | ||
|
|
||
| if [[ "$TAG" == *"-nightly"* ]]; then | ||
| SUFFIX=" \\(Nightly Release\\)" | ||
| SUFFIXPLAIN=" (Nightly Release)" | ||
| else | ||
| SUFFIX="" | ||
| SUFFIXPLAIN="" | ||
| fi | ||
|
|
||
| # Announcement line — also escape for safety | ||
| ANNOUNCE_SAFE="📢 Acode [$TAG_SAFE]($URL) was just Released 🎉${SUFFIX}\\!" | ||
|
|
||
| echo "announce=$ANNOUNCE_SAFE" >> $GITHUB_OUTPUT | ||
| { | ||
| echo "body_safe<<$DELIMITER" | ||
| printf '%s\n' "$BODY_SAFE" | ||
| echo "$DELIMITER" | ||
| } >> $GITHUB_OUTPUT | ||
|
|
||
| # Plain (MD) Announcement for Discord | ||
| ANNOUNCE_PLAIN="📢 Acode [$TAG]($URL) was just Released 🎉${SUFFIXPLAIN}!" | ||
| echo "announce_plain=$ANNOUNCE_PLAIN" >> $GITHUB_OUTPUT | ||
| { | ||
| echo "body_plain<<$DELIMITER" | ||
| printf '%s\n' "$INPUT_BODY" | ||
| echo "$DELIMITER" | ||
| } >> $GITHUB_OUTPUT | ||
|
|
||
| # ──────────────────────────────────────────────── | ||
| # Truncate for Discord | ||
| # ──────────────────────────────────────────────── | ||
| - name: Truncate message for Discord | ||
| id: truncate-discord | ||
| uses: 2428392/gh-truncate-string-action@b3ff790d21cf42af3ca7579146eedb93c8fb0757 # v1.4.1 | ||
| with: | ||
| maxLength: 2000 | ||
| stringToTruncate: | | ||
| ${{ steps.vars.outputs.announce_plain }} | ||
|
|
||
| ${{ steps.vars.outputs.body_plain }} | ||
|
|
||
| # ──────────────────────────────────────────────── | ||
| # Discord notification | ||
| # ──────────────────────────────────────────────── | ||
| - name: Discord Webhook (Publishing) | ||
| uses: tsickert/discord-webhook@c840d45a03a323fbc3f7507ac7769dbd91bfb164 # v5.3.0 | ||
| with: | ||
| webhook-url: ${{ secrets.DISCORD_WEBHOOK_RELEASE_NOTES }} | ||
| content: ${{ steps.truncate-discord.outputs.string }} | ||
|
|
||
| # ──────────────────────────────────────────────── | ||
| # Telegram notification — MarkdownV2 + no link preview | ||
| # ──────────────────────────────────────────────── | ||
| - name: Send to Telegram | ||
| if: ${{ secrets.TELEGRAM_BOT_TOKEN != "" && secrets.TELEGRAM_CHAT_ID != "" && secrets.TELEGRAM_MESSAGE_THREAD_ID != "" }} | ||
| uses: Salmansha08/telegram-github-action@17c9ce6b4210d2659dca29d34028b02fa29d70ad # or newer tag if available | ||
UnschooledGamer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| with: | ||
| to: ${{ secrets.TELEGRAM_CHAT_ID }} | ||
| token: ${{ secrets.TELEGRAM_BOT_TOKEN }} | ||
| message: | | ||
| ${{ steps.vars.outputs.announce }} | ||
|
|
||
| - name: Discord Webhook Action (Publishing) | ||
| uses: tsickert/discord-webhook@c840d45a03a323fbc3f7507ac7769dbd91bfb164 # v5.3.0 | ||
| with: | ||
| webhook-url: ${{ secrets.DISCORD_WEBHOOK_RELEASE_NOTES }} | ||
| content: ${{ steps.get-release-content.outputs.string }} | ||
| ${{ steps.vars.outputs.body_safe }} | ||
| parse_mode: MarkdownV2 | ||
| disable_web_page_preview: true | ||
| # Only needed for topic-enabled supergroups/channels | ||
| message_thread_id: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }} | ||
| continue-on-error: true | ||
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.