Skip to content

Commit

Permalink
fix: correctly parse the changelog-type from the manifest config (#1498)
Browse files Browse the repository at this point in the history
* test: failing test for parsing changelog-type from manifest

* fix: correctly parse the changelog-type from the manifest config
  • Loading branch information
chingor13 authored Jun 30, 2022
1 parent 19a8e82 commit 452f084
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@ function mergeReleaserConfig(
pathConfig.changelogSections ?? defaultConfig.changelogSections,
changelogPath: pathConfig.changelogPath ?? defaultConfig.changelogPath,
changelogHost: pathConfig.changelogHost ?? defaultConfig.changelogHost,
changelogType: pathConfig.changelogType ?? defaultConfig.changelogType,
releaseAs: pathConfig.releaseAs ?? defaultConfig.releaseAs,
skipGithubRelease:
pathConfig.skipGithubRelease ?? defaultConfig.skipGithubRelease,
Expand Down
13 changes: 13 additions & 0 deletions test/fixtures/manifest/config/changelog-type.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"release-type": "simple",
"changelog-type": "github",
"packages": {
".": {
"component": "root"
},
"packages/bot-config-utils": {
"component": "bot-config-utils",
"changelog-type": "default"
}
}
}
30 changes: 30 additions & 0 deletions test/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,36 @@ describe('Manifest', () => {
).to.eql('https://override.example.com');
});

it('should read changelog type from manifest', async () => {
const getFileContentsStub = sandbox.stub(
github,
'getFileContentsOnBranch'
);
getFileContentsStub
.withArgs('release-please-config.json', 'main')
.resolves(
buildGitHubFileContent(
fixturesPath,
'manifest/config/changelog-type.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.repositoryConfig['.'].changelogType).to.eql('github');
expect(
manifest.repositoryConfig['packages/bot-config-utils'].changelogType
).to.eql('default');
});

it('should throw a configuration error for a missing manifest config', async () => {
const getFileContentsStub = sandbox.stub(
github,
Expand Down

0 comments on commit 452f084

Please sign in to comment.