Skip to content

Commit 1c7dd1f

Browse files
committed
fix: prefer repository URL for release links
1 parent 72adb27 commit 1c7dd1f

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

scripts/release-notes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ function normalizeRepoUrl(url) {
145145

146146
function resolveRepositoryUrl() {
147147
const candidates = [
148-
packageJson.homepage,
149148
typeof packageJson.repository === 'string' ? packageJson.repository : packageJson.repository?.url,
150149
packageJson.bugs?.url,
150+
packageJson.homepage,
151151
];
152152

153153
for (const candidate of candidates) {

scripts/release-upload-notes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ function normalizeRepoUrl(url) {
8080

8181
function resolveRepositoryUrl() {
8282
const candidates = [
83-
packageJson.homepage,
8483
typeof packageJson.repository === 'string' ? packageJson.repository : packageJson.repository?.url,
8584
packageJson.bugs?.url,
85+
packageJson.homepage,
8686
];
8787

8888
for (const candidate of candidates) {

tests/release-notes.test.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ describe('release notes generation', () => {
5858
expect(category).toBe('docs');
5959
});
6060

61+
it('prefers the GitHub repository URL over homepage metadata for compare links', () => {
62+
expect(releaseNotes.resolveRepositoryUrl()).toBe('https://github.com/clawplays/ospec');
63+
});
64+
6165
it('creates fallback metadata when no local override is present', async () => {
6266
const metadata = await releaseNotes.createReleaseMetadata({
63-
tag: '0.3.9',
64-
previousTag: '0.3.8',
67+
tag: '7.7.7',
68+
previousTag: '7.7.6',
6569
repositoryUrl: 'https://github.com/clawplays/ospec',
6670
commits: [
6771
{
@@ -78,7 +82,7 @@ describe('release notes generation', () => {
7882
});
7983

8084
expect(metadata.source).toBe('fallback');
81-
expect(metadata.name).toContain('0.3.9 -');
85+
expect(metadata.name).toContain('7.7.7 -');
8286
expect(metadata.body).toContain('## New');
8387
expect(metadata.body).toContain('## Fixed');
8488
expect(metadata.body).toContain('## Upgrade');

tests/release-upload-notes.test.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ describe('release upload notes helpers', () => {
1919
});
2020
});
2121

22+
it('prefers the GitHub repository URL over homepage metadata for uploads', () => {
23+
expect(releaseUploadNotes.resolveRepositoryUrl()).toBe('https://github.com/clawplays/ospec');
24+
});
25+
2226
it('reads the local release metadata file for upload', () => {
2327
fs.mkdirSync(path.dirname(metadataPath), { recursive: true });
2428
fs.writeFileSync(

0 commit comments

Comments
 (0)