Skip to content

Commit 15d8415

Browse files
rhyslbwclaude
andcommitted
chore(release): add yarn release:refs helper to list release refs
Since workflow_dispatch dropdowns can't be populated from git history, this prints recent release (version) commits so a maintainer can copy a real release ref to nominate for the release workflow's `ref` input. Implemented as release-refs.mjs (matching collectCoverage.mjs). It anchors the grep to the exact release subjects (stable + rc) so reverts, merge commits and other commits that merely mention the phrase don't leak in, and annotates each ref with the @cardano-sdk/core version it carries as a quick anchor to confirm a ref's versions before nominating it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 545a7f5 commit 15d8415

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"version:stable": "lerna version --conventional-graduate --allow-branch master --create-release github -m \"ci: publish packages [skip actions]\" --sign-git-commit",
3737
"publish:rc": "lerna publish from-package --dist-tag rc --yes",
3838
"publish:stable": "lerna publish from-package --yes",
39+
"release:refs": "node release-refs.mjs",
3940
"test": "yarn workspaces foreach -v run test",
4041
"test:build:verify": "yarn workspaces foreach -v run test:build:verify",
4142
"test:e2e": "yarn workspaces foreach -v run test:e2e",

release-refs.mjs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Lists recent release (version) commits with the @cardano-sdk/core version each carries,
2+
// so a maintainer can nominate a real release ref (and its versions) for the `release`
3+
// workflow's `ref` input. workflow_dispatch dropdowns can't be populated from git history,
4+
// so this is the discovery aid. See .github/workflows/release.yaml.
5+
import { execSync } from 'node:child_process';
6+
7+
// Anchored to the exact release subjects (stable + rc) so reverts, merges and other commits
8+
// that merely mention the phrase don't leak in.
9+
const pattern = '^ci: publish (rc )?packages \\[skip actions\\]$';
10+
const limit = Number.parseInt(process.argv[2], 10) || 20;
11+
12+
const log = execSync(`git log -E --grep='${pattern}' --format='%h|%H|%ci' -n ${limit}`, {
13+
encoding: 'utf8'
14+
}).trim();
15+
16+
if (!log) {
17+
console.log('No release commits found.');
18+
process.exit(0);
19+
}
20+
21+
for (const line of log.split('\n')) {
22+
const [short, full, date] = line.split('|');
23+
let version = '?';
24+
try {
25+
version = JSON.parse(execSync(`git show ${full}:packages/core/package.json`, { encoding: 'utf8' })).version;
26+
} catch {
27+
// packages/core/package.json may not exist at very old commits — leave as '?'
28+
}
29+
console.log(`${short} core@${version.padEnd(11)}${date}`);
30+
}

0 commit comments

Comments
 (0)