From f651039535cced9e8fd4f993ca4654264684f047 Mon Sep 17 00:00:00 2001 From: neon <18559658+neonsolstice@users.noreply.github.com> Date: Sat, 23 May 2026 01:49:45 +0000 Subject: [PATCH] build: remove legacy release config and fix hash-based attribution Use a single semantic-release config to avoid diverging behavior, and update the release notes context logic to map authors with full commit hashes and stable issue URLs. --- release.config.cjs | 50 ---------------------------------------------- release.config.js | 12 +++++------ 2 files changed, 6 insertions(+), 56 deletions(-) delete mode 100644 release.config.cjs diff --git a/release.config.cjs b/release.config.cjs deleted file mode 100644 index 3fd4362c9..000000000 --- a/release.config.cjs +++ /dev/null @@ -1,50 +0,0 @@ -// @ts-check - -/** @type {import('semantic-release').GlobalConfig} */ -module.exports = { - branches: ["main"], - tagFormat: "v${version}", - repositoryUrl: "https://github.com/bookorbit/bookorbit", - plugins: [ - [ - "@semantic-release/commit-analyzer", - { - preset: "conventionalcommits", - releaseRules: [ - { type: "feat", release: "minor" }, - { type: "fix", release: "patch" }, - { type: "security", release: "patch" }, - { type: "perf", release: "patch" }, - { type: "db", release: "patch" }, - { type: "revert", release: "patch" }, - { breaking: true, release: "major" }, - ], - }, - ], - [ - "@semantic-release/release-notes-generator", - { - preset: "conventionalcommits", - linkReferences: true, - presetConfig: { - types: [ - { type: "feat", section: "Features" }, - { type: "fix", section: "Bug Fixes" }, - { type: "security", section: "Security" }, - { type: "perf", section: "Performance" }, - { type: "db", section: "Database" }, - { type: "revert", section: "Reverts" }, - { type: "docs", hidden: true }, - { type: "chore", hidden: true }, - { type: "refactor", hidden: true }, - { type: "style", hidden: true }, - { type: "test", hidden: true }, - { type: "build", hidden: true }, - { type: "ci", hidden: true }, - ], - }, - }, - ], - "@semantic-release/github", - ], -}; diff --git a/release.config.js b/release.config.js index 1068d72d0..122c2b944 100644 --- a/release.config.js +++ b/release.config.js @@ -42,7 +42,7 @@ const commitPartial = `\ {{~#if this.owner}} {{~this.owner}}/ {{~/if}} - {{~this.repository}}{{this.prefix}}{{this.issue}}]({{issueUrlFormat}}) + {{~this.repository}}{{this.prefix}}{{this.issue}}]({{@root.host}}/{{@root.owner}}/{{@root.repository}}/issues/{{this.issue}}) {{~else}} {{~#if this.owner}} {{~this.owner}}/ @@ -94,7 +94,7 @@ const mainTemplate = [ // for the commitPartial. function finalizeContext(ctx) { try { - const result = spawnSync("git", ["log", "--format=%h %aN", "--max-count=500"], { + const result = spawnSync("git", ["log", "--format=%H %aN", "--max-count=500"], { encoding: "utf8", cwd: process.cwd(), }); @@ -103,17 +103,17 @@ function finalizeContext(ctx) { if (result.status === 0) { for (const line of result.stdout.split("\n").filter(Boolean)) { const spaceIdx = line.indexOf(" "); - const shortSha = line.substring(0, spaceIdx); + const hash = line.substring(0, spaceIdx); const authorName = line.substring(spaceIdx + 1).trim(); if (!authorName || /\[bot\]/i.test(authorName)) continue; - shaToGithubUser.set(shortSha, AUTHOR_MAP[authorName] ?? authorName); + shaToGithubUser.set(hash, AUTHOR_MAP[authorName] ?? authorName); } } for (const group of ctx.commitGroups ?? []) { for (const commit of group.commits ?? []) { - if (commit.shortHash) { - const githubUser = shaToGithubUser.get(commit.shortHash); + if (commit.hash) { + const githubUser = shaToGithubUser.get(commit.hash); if (githubUser) commit.githubUser = githubUser; } // Pre-compute commit URL — {{commitUrlFormat}} does not resolve inside