Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(ci): account for truncation note length when slicing ROADMAP.md content

EtienneLescot3f965bdad413
diff --git a/.github/workflows/discord.yaml b/.github/workflows/discord.yaml
index f0d1bd394..f080babf0 100644
--- a/.github/workflows/discord.yaml
+++ b/.github/workflows/discord.yaml
@@ -563,7 +563,6 @@ jobs:
with:
script: |
const ROADMAP_PATTERN = /(^|\/)ROADMAP\.md$|(^|\/)docs\/roadmap\.md$/i;
- const EMBED_DESCRIPTION_LIMIT = 4000; // Discord limit is 4096; safety margin
const botToken = (process.env.DISCORD_BOT_TOKEN || "").trim();
const channelId = (process.env.DISCORD_ROADMAP_CHANNEL_ID || "").trim();
@@ -634,10 +633,13 @@ jobs:
// 3. Truncate if it exceeds Discord's embed description limit.
const rawUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/blob/main/ROADMAP.md`;
+ const truncationNote = `\n\n… *(truncated, see [full file on GitHub](${rawUrl}))*`;
+ // The truncation note itself consumes characters, so slice content to leave room.
+ const maxContentLength = 4096 - truncationNote.length;
let description = content;
let truncated = false;
- if (content.length > EMBED_DESCRIPTION_LIMIT) {
- description = content.slice(0, EMBED_DESCRIPTION_LIMIT) + `\n\n… *(truncated, see [full file on GitHub](${rawUrl}))*`;
+ if (content.length > maxContentLength) {
+ description = content.slice(0, maxContentLength) + truncationNote;
truncated = true;
}