Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(ci): restore mention suppression and patch resilience after webhook migration
EtienneLescot6f2cf86cb4f4
diff --git a/.github/scripts/discord-bot-api.mjs b/.github/scripts/discord-bot-api.mjsindex b26a838cd..531a98f7e 100644--- a/.github/scripts/discord-bot-api.mjs+++ b/.github/scripts/discord-bot-api.mjs@@ -15,9 +15,7 @@ async function callDiscord(botToken, method, path, body) {if (res.status === 429) {const txt = await res.text();warning(`Discord rate-limited (429) on ${method} ${path}: ${txt}`);- const err = new Error(`Discord rate-limited (429)`);- err.rateLimited = true;- throw err;+ throw new Error(`Discord rate-limited (429) on ${method} ${path}`);}if (!res.ok) {diff --git a/.github/scripts/discord-bot-api.test.mjs b/.github/scripts/discord-bot-api.test.mjsindex d4b5e6f6f..f0190892e 100644--- a/.github/scripts/discord-bot-api.test.mjs+++ b/.github/scripts/discord-bot-api.test.mjs@@ -44,12 +44,12 @@ describe("discord-bot-api", () => {});});- it("throws with rateLimited flag on 429", async () => {+ it("throws a rate-limited error on 429", async () => {mockDiscordResponse({ status: 429, body: { retry_after: 1 } });await expect(createForumThread({ botToken, forumChannelId: "f", payload: { name: "x" } }),- ).rejects.toMatchObject({ rateLimited: true });+ ).rejects.toThrow(/rate-limited \(429\)/);});it("throws on non-ok responses with status in message", async () => {diff --git a/.github/scripts/discord-pr-sync.mjs b/.github/scripts/discord-pr-sync.mjsindex 0f9123265..a40e34f4b 100644--- a/.github/scripts/discord-pr-sync.mjs+++ b/.github/scripts/discord-pr-sync.mjs@@ -8,6 +8,8 @@ const reviewerRoleId = (process.env.DISCORD_REVIEWER_ROLE_ID || "").trim();const forumChannelId = (process.env.DISCORD_PR_FORUM_CHANNEL_ID || "").trim();const alertChannelId = (process.env.DISCORD_ALERT_CHANNEL_ID || "").trim();+const THREAD_MARKER_REGEX = /<!--\s*discord-thread-id:(\d+)\s*-->/i;+const TAGS = {open: "1493976692967080096",draft: "1493976782028935279",@@ -44,13 +46,23 @@ function extractThreadId(body) {return match ? match[1] : null;}-const THREAD_MARKER_REGEX = /<!--\s*discord-thread-id:(\d+)\s*-->/i;-function upsertThreadMarker(body, threadId) {const cleaned = (body || "").replace(THREAD_MARKER_REGEX, "").trim();return `${cleaned}\n\n<!-- discord-thread-id:${threadId} -->`.trim();}+const NO_MENTIONS = { allowed_mentions: { parse: [] } };++async function safePatchChannel(args, contextLabel) {+ try {+ await patchChannel(args);+ } catch (err) {+ warning(+ `Discord thread patch failed for ${contextLabel} (continuing): ${err && err.message ? err.message : err}`,+ );+ }+}+function desiredStatusTag(prState) {if (prState.merged && TAGS.merged) return TAGS.merged;if (prState.closed && !prState.merged && TAGS.closed) return TAGS.closed;@@ -198,6 +210,7 @@ async function main() {timestamp: new Date().toISOString(),},],+ allowed_mentions: { parse: [] },},};@@ -244,14 +257,17 @@ async function main() {});const mappedLabelTags = tagIdsFromLabels(labels);const appliedTags = [...new Set([statusTag, ...mappedLabelTags].filter(Boolean))].slice(0, 5);- await patchChannel({- botToken,- channelId: threadId,- payload: {- name: trimThreadName(`PR #${number} - ${title}`),- ...(appliedTags.length ? { applied_tags: appliedTags } : {}),+ await safePatchChannel(+ {+ botToken,+ channelId: threadId,+ payload: {+ name: trimThreadName(`PR #${number} - ${title}`),+ ...(appliedTags.length ? { applied_tags: appliedTags } : {}),+ },},- });+ `tag refresh on ${action}`,+ );}let updateMessage = null;@@ -300,14 +316,17 @@ async function main() {0,5,);- await patchChannel({- botToken,- channelId: threadId,- payload: {- ...(appliedTags.length ? { applied_tags: appliedTags } : {}),- ...(isMerged ? { archived: true, locked: true } : {}),+ await safePatchChannel(+ {+ botToken,+ channelId: threadId,+ payload: {+ ...(appliedTags.length ? { applied_tags: appliedTags } : {}),+ ...(isMerged ? { archived: true, locked: true } : {}),+ },},- });+ `close (${isMerged ? "merged" : "closed without merge"})`,+ );updateMessage = isMerged? `✅ PR #${number} was merged`@@ -356,13 +375,16 @@ async function main() {0,5,);- await patchChannel({- botToken,- channelId: threadId,- payload: {- ...(appliedTags.length ? { applied_tags: appliedTags } : {}),+ await safePatchChannel(+ {+ botToken,+ channelId: threadId,+ payload: {+ ...(appliedTags.length ? { applied_tags: appliedTags } : {}),+ },},- });+ `review ${state}`,+ );}}} else if (context.eventName === "issue_comment") {@@ -385,7 +407,7 @@ async function main() {return;}- const payload = { content: updateMessage || "" };+ const payload = { content: updateMessage || "", ...NO_MENTIONS };if (updateEmbed) payload.embeds = [updateEmbed];await postChannelMessage({ botToken, channelId: threadId, payload });info(`Posted update to Discord thread ${threadId}.`);@@ -402,7 +424,7 @@ async function main() {channelId: alertChannelId,payload: {content: `⚠️ PR->Discord sync failed\n${msg}\nRun: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,- allowed_mentions: { parse: [] },+ ...NO_MENTIONS,},});} catch (alertErr) {diff --git a/.github/workflows/discord-pr-notify.yml b/.github/workflows/discord-pr-notify.ymlindex 7e5323757..20ed1c47c 100644--- a/.github/workflows/discord-pr-notify.yml+++ b/.github/workflows/discord-pr-notify.yml@@ -37,4 +37,4 @@ jobs:DISCORD_PR_FORUM_CHANNEL_ID: ${{ vars.DISCORD_PR_FORUM_CHANNEL_ID }}DISCORD_ALERT_CHANNEL_ID: ${{ vars.DISCORD_ALERT_CHANNEL_ID }}GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- run: node .github/scripts/discord-pr-sync.mjs\ No newline at end of file+ run: node .github/scripts/discord-pr-sync.mjsdiff --git a/.github/workflows/discord-weekly-leaderboard.yml b/.github/workflows/discord-weekly-leaderboard.ymlindex 770efc52f..9724e36de 100644--- a/.github/workflows/discord-weekly-leaderboard.yml+++ b/.github/workflows/discord-weekly-leaderboard.yml@@ -24,4 +24,4 @@ jobs:DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}DISCORD_SPOTLIGHT_CHANNEL_ID: ${{ vars.DISCORD_SPOTLIGHT_CHANNEL_ID }}GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- run: node .github/scripts/discord-weekly-leaderboard.mjs\ No newline at end of file+ run: node .github/scripts/discord-weekly-leaderboard.mjs