Skip to content
This repository was archived by the owner on Apr 5, 2026. It is now read-only.

Commit 9be0576

Browse files
committed
feat: include CHANGELOG in GitHub releases and fix Telegram formatting (#67)
- Release workflow now extracts the relevant CHANGELOG.md section as the release body instead of auto-generated commit list - Telegram notifications convert Markdown to HTML (bold, code, links, headings) so comments render properly in the channel - Increase Telegram body limit from 500 to 2000 chars - Backfilled all existing releases (v3.0.8 through v3.4.0) with CHANGELOG content
1 parent e8303ea commit 9be0576

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@ jobs:
6666
cd release
6767
sha256sum mtproto-proxy-linux-* > SHA256SUMS
6868
69+
- name: Extract changelog
70+
run: |
71+
VERSION="${GITHUB_REF_NAME#v}"
72+
awk "/^## \\[${VERSION}\\]/{found=1; next} /^## \\[/{if(found) exit} found{print}" CHANGELOG.md > release-notes.md
73+
6974
- name: Create GitHub Release
7075
uses: softprops/action-gh-release@v2
7176
with:
7277
files: release/*
73-
generate_release_notes: true
78+
body_path: release-notes.md

.github/workflows/telegram-notify.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,34 @@ jobs:
2525
const chatId = process.env.TELEGRAM_CHAT_ID;
2626
if (!token || !chatId) return;
2727
28+
function mdToHtml(md) {
29+
let s = md;
30+
// Escape HTML entities first
31+
s = s.replace(/&/g, '&');
32+
s = s.replace(/</g, '&lt;');
33+
s = s.replace(/>/g, '&gt;');
34+
// Markdown headings → bold
35+
s = s.replace(/^#{1,6}\s+(.+)$/gm, '<b>$1</b>');
36+
// Inline code (before bold/italic to avoid conflicts)
37+
s = s.replace(/`([^`]+)`/g, '<code>$1</code>');
38+
// Bold **text** or __text__
39+
s = s.replace(/\*\*(.+?)\*\*/g, '<b>$1</b>');
40+
s = s.replace(/__(.+?)__/g, '<b>$1</b>');
41+
// Italic *text* or _text_ (not inside words)
42+
s = s.replace(/(?<!\w)\*([^*]+)\*(?!\w)/g, '<i>$1</i>');
43+
s = s.replace(/(?<!\w)_([^_]+)_(?!\w)/g, '<i>$1</i>');
44+
// Links [text](url)
45+
s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
46+
return s;
47+
}
48+
2849
let text = '';
2950
const event = context.eventName;
3051
const repo = context.payload.repository.full_name;
3152
3253
if (event === 'release') {
3354
const r = context.payload.release;
34-
const body = r.body ? r.body.substring(0, 500) : '';
55+
const body = r.body ? mdToHtml(r.body.substring(0, 2000)) : '';
3556
text = `🚀 <b>New Release: ${r.tag_name}</b>\n\n${body}\n\n<a href="${r.html_url}">Release notes</a> | <a href="https://github.com/${repo}">GitHub</a>`;
3657
} else if (event === 'issues' && context.payload.action === 'opened') {
3758
// Skip bot-created issues
@@ -45,7 +66,7 @@ jobs:
4566
// Skip auto-reply bot comments
4667
if (c.user.type === 'Bot') return;
4768
const i = context.payload.issue;
48-
const snippet = c.body.substring(0, 300);
69+
const snippet = mdToHtml(c.body.substring(0, 2000));
4970
text = `💬 <b>Comment on #${i.number}</b>: ${i.title}\n\n${snippet}\n\n<a href="${c.html_url}">View comment</a>`;
5071
}
5172

0 commit comments

Comments
 (0)