diff --git a/src/manifest.ts b/src/manifest.ts index 8ea11ffed..cd760d291 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -1422,6 +1422,7 @@ function extractReleaserConfig( labels: config['label']?.split(','), releaseLabels: config['release-label']?.split(','), extraLabels: config['extra-label']?.split(','), + snapshotLabels: config['snapshot-label']?.split(','), skipSnapshot: config['skip-snapshot'], initialVersion: config['initial-version'], excludePaths: config['exclude-paths'], @@ -1790,6 +1791,7 @@ function mergeReleaserConfig( skipSnapshot: pathConfig.skipSnapshot ?? defaultConfig.skipSnapshot, initialVersion: pathConfig.initialVersion ?? defaultConfig.initialVersion, extraLabels: pathConfig.extraLabels ?? defaultConfig.extraLabels, + snapshotLabels: pathConfig.snapshotLabels ?? defaultConfig.snapshotLabels, excludePaths: pathConfig.excludePaths ?? defaultConfig.excludePaths, dateFormat: pathConfig.dateFormat ?? defaultConfig.dateFormat, }; diff --git a/test/fixtures/manifest/config/snapshot-labels.json b/test/fixtures/manifest/config/snapshot-labels.json new file mode 100644 index 000000000..d125515cd --- /dev/null +++ b/test/fixtures/manifest/config/snapshot-labels.json @@ -0,0 +1,13 @@ +{ + "release-type": "java", + "snapshot-label": "global-snapshot", + "packages": { + ".": { + "component": "root" + }, + "node-lib": { + "component": "node-lib", + "snapshot-label": "per-package-snapshot" + } + } +} diff --git a/test/manifest.ts b/test/manifest.ts index 2906eb5e7..831b967a8 100644 --- a/test/manifest.ts +++ b/test/manifest.ts @@ -506,6 +506,38 @@ describe('Manifest', () => { 'lang: nodejs', ]); }); + it('should read snapshot labels from manifest', async () => { + const getFileContentsStub = sandbox.stub( + github, + 'getFileContentsOnBranch' + ); + getFileContentsStub + .withArgs('release-please-config.json', 'main') + .resolves( + buildGitHubFileContent( + fixturesPath, + 'manifest/config/snapshot-labels.json' + ) + ) + .withArgs('.release-please-manifest.json', 'main') + .resolves( + buildGitHubFileContent( + fixturesPath, + 'manifest/versions/versions.json' + ) + ); + const manifest = await Manifest.fromManifest( + github, + github.repository.defaultBranch + ); + expect(manifest['snapshotLabels']).to.deep.equal(['global-snapshot']); + expect(manifest.repositoryConfig['.'].snapshotLabels).to.deep.equal([ + 'global-snapshot', + ]); + expect( + manifest.repositoryConfig['node-lib'].snapshotLabels + ).to.deep.equal(['per-package-snapshot']); + }); it('should read exclude paths from manifest', async () => { const getFileContentsStub = sandbox.stub( github,