diff --git a/src/strategies/base.ts b/src/strategies/base.ts index b169f99f5..4af681837 100644 --- a/src/strategies/base.ts +++ b/src/strategies/base.ts @@ -22,7 +22,6 @@ import { MANIFEST_PULL_REQUEST_TITLE_PATTERN, ExtraFile, DEFAULT_CUSTOM_VERSION_LABEL, - DEFAULT_RELEASE_PLEASE_MANIFEST, } from '../manifest'; import {DefaultVersioningStrategy} from '../versioning-strategies/default'; import {DefaultChangelogNotes} from '../changelog-notes/default'; @@ -275,14 +274,12 @@ export abstract class BaseStrategy implements Strategy { labels = [], latestRelease, draft, - manifestPath, }: { commits: Commit[]; latestRelease?: Release; draft?: boolean; labels?: string[]; existingPullRequest?: PullRequest; - manifestPath?: string; }): Promise { this.logger.info(`Considering: ${commits.length} raw commits`); @@ -391,13 +388,7 @@ To set a custom version be sure to use the [semantic versioning format](https:// } else { // look at the manifest from release branch and compare against version from PR title try { - const manifest = - (await this.github.getFileJson>( - manifestPath || DEFAULT_RELEASE_PLEASE_MANIFEST, - existingPullRequest.headBranchName - )) || {}; - const componentVersion = manifest[component || '.']; - if (componentVersion !== existingPRTitleVersion?.toString()) { + if (newVersion.toString() !== existingPRTitleVersion.toString()) { // version from title has been edited, add custom version label, a comment, and use the title version this.github.addIssueLabels( [DEFAULT_CUSTOM_VERSION_LABEL], diff --git a/src/strategies/java.ts b/src/strategies/java.ts index b114b8cdb..06f1d623c 100644 --- a/src/strategies/java.ts +++ b/src/strategies/java.ts @@ -79,14 +79,12 @@ export class Java extends BaseStrategy { labels = [], latestRelease, draft, - manifestPath, }: { commits: ConventionalCommit[]; latestRelease?: Release; draft?: boolean; labels?: string[]; existingPullRequest?: PullRequest; - manifestPath?: string; }): Promise { if (await this.needsSnapshot(commits, latestRelease)) { this.logger.info('Repository needs a snapshot bump.'); @@ -102,7 +100,6 @@ export class Java extends BaseStrategy { latestRelease, draft, labels, - manifestPath, }); } diff --git a/test/manifest.ts b/test/manifest.ts index d1e15f215..10b33e50f 100644 --- a/test/manifest.ts +++ b/test/manifest.ts @@ -2494,28 +2494,6 @@ describe('Manifest', () => { }) ) ) - .withArgs( - '.release-please-manifest.json', - 'release-please--branches--main--changes--next--components--pkg1' - ) - .resolves( - buildGitHubFileRaw( - JSON.stringify({ - 'path/a': '1.0.1', - }) - ) - ) - .withArgs( - '.release-please-manifest.json', - 'release-please--branches--main--changes--next--components--pkg2' - ) - .resolves( - buildGitHubFileRaw( - JSON.stringify({ - 'path/b': '2.0.1', - }) - ) - ) .withArgs('path/b/package.json', 'next') .resolves( buildGitHubFileRaw( @@ -2523,38 +2501,6 @@ describe('Manifest', () => { name: 'pkg2', }) ) - ) - .withArgs( - '.release-please-manifest.json', - 'release-please--branches--main--changes--next--components--pkg3' - ) - .resolves( - buildGitHubFileRaw( - JSON.stringify({ - 'path/c': '3.0.1', - }) - ) - ) - .withArgs('path/c/setup.py', 'next') - .resolves( - buildGitHubFileRaw( - ` -name = "pkg3" -description = "Something" -version = "3.0.0" -` - ) - ) - .withArgs( - '.release-please-manifest.json', - 'release-please--branches--main--changes--next--components--pkg4' - ) - .resolves( - buildGitHubFileRaw( - JSON.stringify({ - 'path/d': '4.0.1', - }) - ) ); const findFilesByFilenameAndRefStub = sandbox @@ -2589,7 +2535,7 @@ version = "3.0.0" const pullRequests = await manifest.buildPullRequests( [ { - title: 'chore(main): release v6.7.9-alpha.1', // version from title differs from PR manifest + title: 'chore(main): release v6.7.9-alpha.1', // version from title differs from expected 4.0.1 body: 'some content', headBranchName: 'release-please--branches--main--changes--next--components--pkg1', @@ -2599,7 +2545,7 @@ version = "3.0.0" files: [], }, { - title: 'chore(main): release v7.8.9', // version from title differs from PR manifest + title: 'chore(main): release v7.8.9', // version from title differs from expected 4.0.1 body: 'some content', headBranchName: 'release-please--branches--main--changes--next--components--pkg2', @@ -2609,7 +2555,7 @@ version = "3.0.0" files: [], }, { - title: 'chore(main): release 8.9.0', // version from title differs from PR manifest + title: 'chore(main): release 8.9.0', // version from title differs from expected 4.0.1 body: 'some content', headBranchName: 'release-please--branches--main--changes--next--components--pkg3', @@ -2619,7 +2565,7 @@ version = "3.0.0" files: [], }, { - title: 'chore(main): release v9.0.1', // version from title differs from PR manifest + title: 'chore(main): release v9.0.1', // version from title differs from expected 4.0.1 body: 'some content', headBranchName: 'release-please--branches--main--changes--next--components--pkg4', @@ -2636,9 +2582,9 @@ version = "3.0.0" expect(pullRequests[1].version?.toString()).to.eql('7.8.9'); expect(pullRequests[2].version?.toString()).to.eql('8.9.0'); expect(pullRequests[3].version?.toString()).to.eql('9.0.1'); - sinon.assert.called(getFileContentsOnBranchStub); sinon.assert.called(addIssueLabelsStub); sinon.assert.called(findFilesByFilenameAndRefStub); + sinon.assert.called(getFileContentsOnBranchStub); expect(commentCount).to.eql(4); });