Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
98b423c28This file is pinned to the selected release. Download the original to open it in your design tool.
name: Discord notify
# Posts to Discord via webhook when new commits land on main → #dev-log
# (DISCORD_WEBHOOK_DEV). Set the secret under Settings → Secrets and variables
# → Actions; if it is missing the job no-ops instead of failing.
#
# Releases used to post to #announcements from here, with an @here. Removed:
# cutting a release is a housekeeping act as often as it is news — a tag that
# just catches the manifest up does not deserve a room-wide ping, and having
# to think about who gets woken up is a reason not to tag things. Announcing a
# release is now a deliberate, human act. Restore from git history if that
# ever turns out to be the wrong trade.
on:
push:
branches: [main]
jobs:
commits:
runs-on: ubuntu-latest
steps:
- name: Post commits to #dev-log
uses: actions/github-script@v7
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_DEV }}
with:
script: |
const webhook = process.env.DISCORD_WEBHOOK;
if (!webhook) { core.info("DISCORD_WEBHOOK not set — skipping."); return; }
const commits = context.payload.commits || [];
if (commits.length === 0) { core.info("No commits in payload — skipping."); return; }
const repo = `${context.repo.owner}/${context.repo.repo}`;
const lines = commits.map((c) => {
const sha = c.id.slice(0, 7);
const msg = c.message.split("\n")[0].slice(0, 120);
return `[\`${sha}\`](${c.url}) ${msg} — ${c.author.name}`;
});
const payload = {
embeds: [{
title: `📦 ${commits.length} new commit${commits.length > 1 ? "s" : ""} on main`,
description: lines.join("\n").slice(0, 4000),
url: context.payload.compare,
color: 0x5865f2,
footer: { text: repo },
timestamp: new Date().toISOString(),
}],
};
const res = await fetch(webhook, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
if (!res.ok) core.setFailed(`Discord responded ${res.status}: ${await res.text()}`);