Skip to content

Commit 1cde11c

Browse files
fix(manifest): apply per-package snapshot-label from config
`extractReleaserConfig` was not mapping the `snapshot-label` key from per-package `release-please-config.json` blocks, and `mergeReleaserConfig` was not propagating it from the root default into per-package configs. As a result, Java/Maven snapshot PRs fell back to `DEFAULT_SNAPSHOT_LABELS` (`['autorelease: snapshot']`) regardless of configuration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3ab7aec commit 1cde11c

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

src/manifest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,7 @@ function extractReleaserConfig(
14221422
labels: config['label']?.split(','),
14231423
releaseLabels: config['release-label']?.split(','),
14241424
extraLabels: config['extra-label']?.split(','),
1425+
snapshotLabels: config['snapshot-label']?.split(','),
14251426
skipSnapshot: config['skip-snapshot'],
14261427
initialVersion: config['initial-version'],
14271428
excludePaths: config['exclude-paths'],
@@ -1790,6 +1791,7 @@ function mergeReleaserConfig(
17901791
skipSnapshot: pathConfig.skipSnapshot ?? defaultConfig.skipSnapshot,
17911792
initialVersion: pathConfig.initialVersion ?? defaultConfig.initialVersion,
17921793
extraLabels: pathConfig.extraLabels ?? defaultConfig.extraLabels,
1794+
snapshotLabels: pathConfig.snapshotLabels ?? defaultConfig.snapshotLabels,
17931795
excludePaths: pathConfig.excludePaths ?? defaultConfig.excludePaths,
17941796
dateFormat: pathConfig.dateFormat ?? defaultConfig.dateFormat,
17951797
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"release-type": "java",
3+
"snapshot-label": "global-snapshot",
4+
"packages": {
5+
".": {
6+
"component": "root"
7+
},
8+
"node-lib": {
9+
"component": "node-lib",
10+
"snapshot-label": "per-package-snapshot"
11+
}
12+
}
13+
}

test/manifest.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,38 @@ describe('Manifest', () => {
506506
'lang: nodejs',
507507
]);
508508
});
509+
it('should read snapshot labels from manifest', async () => {
510+
const getFileContentsStub = sandbox.stub(
511+
github,
512+
'getFileContentsOnBranch'
513+
);
514+
getFileContentsStub
515+
.withArgs('release-please-config.json', 'main')
516+
.resolves(
517+
buildGitHubFileContent(
518+
fixturesPath,
519+
'manifest/config/snapshot-labels.json'
520+
)
521+
)
522+
.withArgs('.release-please-manifest.json', 'main')
523+
.resolves(
524+
buildGitHubFileContent(
525+
fixturesPath,
526+
'manifest/versions/versions.json'
527+
)
528+
);
529+
const manifest = await Manifest.fromManifest(
530+
github,
531+
github.repository.defaultBranch
532+
);
533+
expect(manifest['snapshotLabels']).to.deep.equal(['global-snapshot']);
534+
expect(manifest.repositoryConfig['.'].snapshotLabels).to.deep.equal([
535+
'global-snapshot',
536+
]);
537+
expect(
538+
manifest.repositoryConfig['node-lib'].snapshotLabels
539+
).to.deep.equal(['per-package-snapshot']);
540+
});
509541
it('should read exclude paths from manifest', async () => {
510542
const getFileContentsStub = sandbox.stub(
511543
github,

0 commit comments

Comments
 (0)