Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions src/strategies/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<ReleasePullRequest | undefined> {
this.logger.info(`Considering: ${commits.length} raw commits`);

Expand Down Expand Up @@ -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<Record<string, string>>(
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],
Expand Down
3 changes: 0 additions & 3 deletions src/strategies/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReleasePullRequest | undefined> {
if (await this.needsSnapshot(commits, latestRelease)) {
this.logger.info('Repository needs a snapshot bump.');
Expand All @@ -102,7 +100,6 @@ export class Java extends BaseStrategy {
latestRelease,
draft,
labels,
manifestPath,
});
}

Expand Down
64 changes: 5 additions & 59 deletions test/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2494,67 +2494,13 @@ 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(
JSON.stringify({
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
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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);
});

Expand Down