Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions scripts/changelog-codenames.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ if (!codenameBin) {
process.exit(1);
}

const releases = JSON.parse(readFileSync(0, "utf8"));
const input = readFileSync(0, "utf8").trim();
if (!input) {
console.error(
"changelog-codenames.mjs: empty stdin — the upstream git-cliff produced no context",
);
process.exit(1);
}

const releases = JSON.parse(input);
for (const release of releases) {
// Unreleased sections have a null version and get no codename.
if (!release.version) continue;
if (!release.version) {
continue;
}
const codename = execFileSync(codenameBin, [release.version], {
encoding: "utf8",
}).trim();
Expand Down
12 changes: 11 additions & 1 deletion scripts/release-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,17 @@ TITLE="$TAG \"$RELEASE_CODENAME\""
echo "Creating GitHub release ${TAG} (${RELEASE_CODENAME})..."
NOTES_FILE="$(mktemp)"
trap 'rm -f "$NOTES_FILE"' EXIT
git-cliff --current --tag "$TAG" -x 2>/dev/null \
# Scope git-cliff to this release. Locally the tag already exists, so --current
# selects its section; in CI the tag is created later (below), so --unreleased
# picks up the not-yet-tagged commits and --tag names them. Using --current
# without an existing tag fails with empty output, which would silently fall
# back to GitHub's auto-notes.
if git rev-parse "$TAG" >/dev/null 2>&1; then
CLIFF_SCOPE="--current"
else
CLIFF_SCOPE="--unreleased"
fi
git-cliff "$CLIFF_SCOPE" --tag "$TAG" -x 2>/dev/null \
| bun scripts/changelog-codenames.mjs "$CODENAME_BIN" \
| git-cliff --from-context - --strip header > "$NOTES_FILE" 2>/dev/null || true

Expand Down
Loading