Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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 Jan 1, 2026
f37982c
Remove redundant check for message prefix
UnschooledGamer Jan 1, 2026
6304f5a
update: community-release-notifier with Telegram support
UnschooledGamer Mar 9, 2026
7b5553f
Merge pull request #12 from UnschooledGamer/UnschooledGamer-patch-1-1
UnschooledGamer Mar 9, 2026
2da06c5
Merge branch 'Acode-Foundation:UnschooledGamer-patch-1' into Unschool…
UnschooledGamer Mar 9, 2026
800135d
Update Telegram action in workflow file
UnschooledGamer Mar 9, 2026
5837e13
Refactor release variables for safety and clarity
UnschooledGamer Mar 9, 2026
c5828d6
Update .github/workflows/community-release-notifier.yml
UnschooledGamer Mar 9, 2026
72e1f2f
Update .github/workflows/community-release-notifier.yml
UnschooledGamer Mar 9, 2026
9051f44
chore: enhance community release notifier with delimiter
UnschooledGamer Mar 9, 2026
3c783f6
Update .github/workflows/community-release-notifier.yml
UnschooledGamer Mar 9, 2026
4c397d5
Update .github/workflows/community-release-notifier.yml
UnschooledGamer Mar 9, 2026
67cb0a2
Update .github/workflows/community-release-notifier.yml
UnschooledGamer Mar 9, 2026
4fc3f05
Update community-release-notifier.yml
UnschooledGamer Mar 9, 2026
60e7bab
Update community-release-notifier.yml
UnschooledGamer Mar 9, 2026
c57a866
Update .github/workflows/community-release-notifier.yml
UnschooledGamer Mar 9, 2026
6710bc5
Update community-release-notifier.yml
UnschooledGamer Mar 9, 2026
5d852f2
chore: fix telegram creds requirements
UnschooledGamer Mar 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 86 additions & 29 deletions .github/workflows/community-release-notifier.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,101 @@
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
Comment thread
UnschooledGamer marked this conversation as resolved.
TELEGRAM_MESSAGE_THREAD_ID:
description: 'Optional: Topic / message_thread_id for Telegram forum/topic'
required: false
Comment thread
UnschooledGamer marked this conversation as resolved.
Outdated

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 🎉!

${{ github.event.release.body || inputs.body }}

- 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 }}
- name: Prepare release variables
id: vars
run: |
TAG="${{ github.event.release.tag_name || inputs.tag_name }}"
URL="${{ github.event.release.url || inputs.url }}"
# Escape problematic characters for MarkdownV2 (very conservative escaping)
# We escape: _ * [ ] ( ) ~ ` > # + - = | { } . ! \
BODY_SAFE=$(printf '%s' "${{ github.event.release.body || inputs.body }}" | \
sed 's/[_*[\]()~`>#+-=|{}.!\\]/\\&/g')
Comment thread
UnschooledGamer marked this conversation as resolved.
Outdated

if [[ "$TAG" == *"-nightly"* ]]; then
SUFFIX=" (Nightly Release)"
else
SUFFIX=""
fi

# Announcement line — also escape for safety
ANNOUNCE_SAFE="📢 Acode \[$TAG\]($URL) was just Released 🎉$SUFFIX!"
Comment thread
UnschooledGamer marked this conversation as resolved.
Outdated

echo "announce=$ANNOUNCE_SAFE" >> $GITHUB_OUTPUT
echo "body_safe=$BODY_SAFE" >> $GITHUB_OUTPUT
Comment thread
UnschooledGamer marked this conversation as resolved.
Outdated

# ────────────────────────────────────────────────
# 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 }}

${{ steps.vars.outputs.body_safe }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MarkdownV2-escaped content sent to Discord

steps.vars.outputs.announce and steps.vars.outputs.body_safe are both escaped for Telegram's MarkdownV2 format (backslash-prefixing ., -, !, #, (, ), etc.). This same escaped content is fed directly into the Discord notification.

Discord uses a different markdown dialect: it only strips a leading \ before its own special characters (*, _, `, ~, |). For every other character, a \ is displayed literally. This means:

  • A release note with "Added version 1.2.3" will appear as "Added version 1\.2\.3" in Discord.
  • A tag like v1.0.0-nightly in the announce line will appear as v1\.0\.0\-nightly inside the Discord link text.
  • Any ! escaped as \!, or # escaped as \#, etc. will all show visible backslashes in Discord.

The fix is to produce two separate outputs from the vars step — one for Telegram (MarkdownV2-escaped) and one for Discord (raw/unescaped) — and feed each to the appropriate notification step:

# In the vars step:
echo "announce_plain=📢 Acode $TAG ($URL) was just Released 🎉${SUFFIX_PLAIN}!" >> $GITHUB_OUTPUT
{
  echo "body_plain<<$DELIMITER"
  printf '%s\n' "$INPUT_BODY"
  echo "$DELIMITER"
} >> $GITHUB_OUTPUT

# In the Discord truncate step:
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 }}
continue-on-error: true

# ────────────────────────────────────────────────
# Telegram notification — MarkdownV2 + no link preview
# ────────────────────────────────────────────────
- name: Send to Telegram
uses: Salmansha08/telegram-github-action@17c9ce6b4210d2659dca29d34028b02fa29d70ad # or newer tag if available
Comment thread
UnschooledGamer marked this conversation as resolved.
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: |
${{ steps.vars.outputs.announce }}

${{ 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
Comment thread
UnschooledGamer marked this conversation as resolved.
3 changes: 3 additions & 0 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,6 @@
body: ${{ needs.build.outputs.RELEASE_NOTES }}
secrets:
DISCORD_WEBHOOK_RELEASE_NOTES: ${{ secrets.DISCORD_WEBHOOK_RELEASE_NOTES }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_MESSAGE_THREAD_ID: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}