ci(telegram): use public mhrv_rs link in main-channel post + add invite

Two related changes to the main-channel cross-post (one message per
release that points at the files channel):

1. Post-link now uses the public-username form `t.me/mhrv_rs/<msg_id>`
   instead of the private `t.me/c/<chat_id>/<msg_id>`. The latter only
   resolves for channel members; the former works for everyone, so
   recipients seeing the main-channel announcement can click through
   to a specific release post even if they're not yet subscribed.

   Wired via the existing `FILES_CHANNEL_USERNAME` workflow env var,
   now defaulting to `mhrv_rs` (the channel's public username) if the
   `vars.FILES_CHANNEL_USERNAME` repo variable is unset. Override per
   repo if the channel is renamed.

2. Channel-join links rendered in the body of the main-channel post,
   below the post-link:

       لینک کانال:
       https://t.me/mhrv_rs
       و یا: https://t.me/+R1OyoHX2boA1ZDgx

   Two forms cover the cases where one or the other is filtered:
   - `t.me/mhrv_rs` — public username form, prettier, surfaces in
     Telegram search
   - `t.me/+<hash>` — invite link, the only join path that works for
     private/restricted channels and for users whose client doesn't
     resolve public usernames cleanly

   Wired via new `FILES_CHANNEL_INVITE` env var, defaulting to the
   current invite hash; override via `vars.FILES_CHANNEL_INVITE` if
   rotated.

Per user request — not running this against v1.8.0 retroactively,
just wiring it up for the next release.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
therealaleph
2026-04-28 03:30:37 +03:00
parent 0669b9310c
commit 0d54c5c6fb
2 changed files with 73 additions and 17 deletions
+16 -6
View File
@@ -110,12 +110,22 @@ jobs:
# APK + full changelog. Sourced from the same secret the
# legacy `telegram` job in release.yml used.
MAIN_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
# Optional: if the files channel later gets a public username,
# set the repo variable `FILES_CHANNEL_USERNAME` (without the
# `@`) so the cross-link uses the prettier `t.me/<name>/<msg>`
# form instead of `t.me/c/<id>/<msg>` (which only resolves for
# channel members).
FILES_CHANNEL_USERNAME: ${{ vars.FILES_CHANNEL_USERNAME }}
# Public-username form of the files channel link. Used for
# both (a) the post-link in the main-channel cross-post — so
# `t.me/<name>/<msg>` works for everyone, not just members
# via `t.me/c/<id>/<msg>` — and (b) one of the two
# channel-join links rendered at the bottom of the cross-post.
# Defaults to `mhrv_rs` (current public username); override via
# repo variable if the channel is renamed.
FILES_CHANNEL_USERNAME: ${{ vars.FILES_CHANNEL_USERNAME || 'mhrv_rs' }}
# `t.me/+<hash>` invite link for the files channel. Rendered
# as the second channel-join option in the main-channel
# cross-post — the only join path that works for users coming
# from outside Telegram search (private/restricted channels)
# or whose Telegram client doesn't resolve usernames cleanly.
# Override via repo variable if the channel's invite hash is
# rotated.
FILES_CHANNEL_INVITE: ${{ vars.FILES_CHANNEL_INVITE || 'https://t.me/+R1OyoHX2boA1ZDgx' }}
run: |
if [ -z "${BOT_TOKEN:-}" ]; then
echo "::error::TELEGRAM_BOT_TOKEN not set; can't publish"