Skip to content

Commit e83e833

Browse files
authored
Merge branch 'googleapis:main' into go-workspace
2 parents b31db93 + 3e80797 commit e83e833

12 files changed

+160
-38
lines changed

.github/release-trigger.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
enabled: true
2+
multiScmName: release-please

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "16.14.3"
2+
".": "16.15.0"
33
}

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
66

7+
## [16.15.0](https://github.com/googleapis/release-please/compare/v16.14.4...v16.15.0) (2024-11-13)
8+
9+
10+
### Features
11+
12+
* add `always-update` option to push to always push to release branch ([72d40df](https://github.com/googleapis/release-please/commit/72d40df677b08fd52654a4c3b320649f63b9c635))
13+
14+
## [16.14.4](https://github.com/googleapis/release-please/compare/v16.14.3...v16.14.4) (2024-11-12)
15+
16+
17+
### Bug Fixes
18+
19+
* **deps:** update dependency jsonpath-plus to v10.0.7 [security] ([#2427](https://github.com/googleapis/release-please/issues/2427)) ([f9614e3](https://github.com/googleapis/release-please/commit/f9614e30557a4a0741005f761da87417834d6871))
20+
721
## [16.14.3](https://github.com/googleapis/release-please/compare/v16.14.2...v16.14.3) (2024-10-15)
822

923

__snapshots__/gemfile-lock.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ GEM
1717
rainbow (3.1.1)
1818
rake (13.0.6)
1919
regexp_parser (2.6.1)
20-
rexml (3.2.5)
20+
rexml (3.3.9)
2121
rspec (3.12.0)
2222
rspec-core (~> 3.12.0)
2323
rspec-expectations (~> 3.12.0)
@@ -37,7 +37,7 @@ GEM
3737
parser (>= 3.1.2.1)
3838
rainbow (>= 2.2.2, < 4.0)
3939
regexp_parser (>= 1.8, < 3.0)
40-
rexml (>= 3.2.5, < 4.0)
40+
rexml (>= 3.3.9, < 4.0)
4141
rubocop-ast (>= 1.23.0, < 2.0)
4242
ruby-progressbar (~> 1.7)
4343
unicode-display_width (>= 1.4.0, < 3.0)
@@ -81,7 +81,7 @@ GEM
8181
rainbow (3.1.1)
8282
rake (13.0.6)
8383
regexp_parser (2.6.1)
84-
rexml (3.2.5)
84+
rexml (3.3.9)
8585
rspec (3.12.0)
8686
rspec-core (~> 3.12.0)
8787
rspec-expectations (~> 3.12.0)
@@ -101,7 +101,7 @@ GEM
101101
parser (>= 3.1.2.1)
102102
rainbow (>= 2.2.2, < 4.0)
103103
regexp_parser (>= 1.8, < 3.0)
104-
rexml (>= 3.2.5, < 4.0)
104+
rexml (>= 3.3.9, < 4.0)
105105
rubocop-ast (>= 1.23.0, < 2.0)
106106
ruby-progressbar (~> 1.7)
107107
unicode-display_width (>= 1.4.0, < 3.0)
@@ -145,7 +145,7 @@ GEM
145145
rainbow (3.1.1)
146146
rake (13.0.6)
147147
regexp_parser (2.6.1)
148-
rexml (3.2.5)
148+
rexml (3.3.9)
149149
rspec (3.12.0)
150150
rspec-core (~> 3.12.0)
151151
rspec-expectations (~> 3.12.0)
@@ -165,7 +165,7 @@ GEM
165165
parser (>= 3.1.2.1)
166166
rainbow (>= 2.2.2, < 4.0)
167167
regexp_parser (>= 1.8, < 3.0)
168-
rexml (>= 3.2.5, < 4.0)
168+
rexml (>= 3.3.9, < 4.0)
169169
rubocop-ast (>= 1.23.0, < 2.0)
170170
ruby-progressbar (~> 1.7)
171171
unicode-display_width (>= 1.4.0, < 3.0)

docs/manifest-releaser.md

+7
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ defaults (those are documented in comments)
218218
// absence defaults to false and one pull request will be raised
219219
"separate-pull-requests": false,
220220

221+
// if true, always update existing pull requests when changes are added,
222+
// instead of only when the release notes change.
223+
// This option may increase the number of API calls used, but can be useful
224+
// if pull requests must not be out-of-date with the base branch.
225+
// absence defaults to false
226+
"always-update": true,
227+
221228
// sets the manifest pull request title for when releasing multiple packages
222229
// grouped together in the one pull request.
223230
// This option has no effect when `separate-pull-requests` is `true`.

package-lock.json

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "release-please",
3-
"version": "16.14.3",
3+
"version": "16.15.0",
44
"description": "generate release PRs based on the conventionalcommits.org spec",
55
"main": "./build/src/index.js",
66
"bin": "./build/src/bin/release-please.js",

schemas/config.json

+5
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@
111111
"description": "Open a separate release pull request for each component. Defaults to `false`.",
112112
"type": "boolean"
113113
},
114+
"always-update": {
115+
"description": "Always update the pull request with the latest changes. Defaults to `false`.",
116+
"type": "boolean"
117+
},
114118
"tag-separator": {
115119
"description": "Customize the separator between the component and version in the GitHub tag.",
116120
"type": "string"
@@ -475,6 +479,7 @@
475479
"pull-request-header": true,
476480
"pull-request-footer": true,
477481
"separate-pull-requests": true,
482+
"always-update": true,
478483
"tag-separator": true,
479484
"extra-files": true,
480485
"version-file": true,

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ export const configSchema = require('../../schemas/config.json');
6363
export const manifestSchema = require('../../schemas/manifest.json');
6464

6565
// x-release-please-start-version
66-
export const VERSION = '16.14.3';
66+
export const VERSION = '16.15.0';
6767
// x-release-please-end

src/manifest.ts

+31-19
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ export interface ManifestOptions {
202202
draft?: boolean;
203203
prerelease?: boolean;
204204
draftPullRequest?: boolean;
205+
alwaysUpdate?: boolean;
205206
groupPullRequestTitlePattern?: string;
206207
releaseSearchDepth?: number;
207208
commitSearchDepth?: number;
@@ -264,6 +265,7 @@ export interface ManifestConfig extends ReleaserConfigJson {
264265
'release-search-depth'?: number;
265266
'commit-search-depth'?: number;
266267
'sequential-calls'?: boolean;
268+
'always-update'?: boolean;
267269
}
268270
// path => version
269271
export type ReleasedVersions = Record<string, Version>;
@@ -299,6 +301,7 @@ export class Manifest {
299301
readonly releasedVersions: ReleasedVersions;
300302
private targetBranch: string;
301303
private separatePullRequests: boolean;
304+
private alwaysUpdate: boolean;
302305
readonly fork: boolean;
303306
private signoffUser?: string;
304307
private labels: string[];
@@ -339,6 +342,8 @@ export class Manifest {
339342
* @param {string} manifestOptions.goWorkFile Option for the go-workspace plugin
340343
* @param {boolean} manifestOptions.separatePullRequests If true, create separate pull
341344
* requests instead of a single manifest release pull request
345+
* @param {boolean} manifestOptions.alwaysUpdate If true, always updates pull requests instead of
346+
* only when the release notes change
342347
* @param {PluginType[]} manifestOptions.plugins Any plugins to use for this repository
343348
* @param {boolean} manifestOptions.fork If true, create pull requests from a fork. Defaults
344349
* to `false`
@@ -366,6 +371,7 @@ export class Manifest {
366371
this.separatePullRequests =
367372
manifestOptions?.separatePullRequests ??
368373
Object.keys(repositoryConfig).length === 1;
374+
this.alwaysUpdate = manifestOptions?.alwaysUpdate || false;
369375
this.fork = manifestOptions?.fork || false;
370376
this.signoffUser = manifestOptions?.signoff;
371377
this.releaseLabels =
@@ -1022,7 +1028,9 @@ export class Manifest {
10221028
openPullRequest.headBranchName === pullRequest.headRefName
10231029
);
10241030
if (existing) {
1025-
return await this.maybeUpdateExistingPullRequest(existing, pullRequest);
1031+
return this.alwaysUpdate
1032+
? await this.updateExistingPullRequest(existing, pullRequest)
1033+
: await this.maybeUpdateExistingPullRequest(existing, pullRequest);
10261034
}
10271035

10281036
// look for closed, snoozed pull request
@@ -1031,7 +1039,9 @@ export class Manifest {
10311039
openPullRequest.headBranchName === pullRequest.headRefName
10321040
);
10331041
if (snoozed) {
1034-
return await this.maybeUpdateSnoozedPullRequest(snoozed, pullRequest);
1042+
return this.alwaysUpdate
1043+
? await this.updateExistingPullRequest(snoozed, pullRequest)
1044+
: await this.maybeUpdateSnoozedPullRequest(snoozed, pullRequest);
10351045
}
10361046

10371047
const body = await this.pullRequestOverflowHandler.handleOverflow(
@@ -1074,20 +1084,10 @@ export class Manifest {
10741084
);
10751085
return undefined;
10761086
}
1077-
const updatedPullRequest = await this.github.updatePullRequest(
1078-
existing.number,
1079-
pullRequest,
1080-
this.targetBranch,
1081-
{
1082-
fork: this.fork,
1083-
signoffUser: this.signoffUser,
1084-
pullRequestOverflowHandler: this.pullRequestOverflowHandler,
1085-
}
1086-
);
1087-
return updatedPullRequest;
1087+
return await this.updateExistingPullRequest(existing, pullRequest);
10881088
}
10891089

1090-
/// only update an snoozed pull request if it has release note changes
1090+
/// only update a snoozed pull request if it has release note changes
10911091
private async maybeUpdateSnoozedPullRequest(
10921092
snoozed: PullRequest,
10931093
pullRequest: ReleasePullRequest
@@ -1099,8 +1099,22 @@ export class Manifest {
10991099
);
11001100
return undefined;
11011101
}
1102-
const updatedPullRequest = await this.github.updatePullRequest(
1103-
snoozed.number,
1102+
const updatedPullRequest = await this.updateExistingPullRequest(
1103+
snoozed,
1104+
pullRequest
1105+
);
1106+
// TODO: consider leaving the snooze label
1107+
await this.github.removeIssueLabels([SNOOZE_LABEL], snoozed.number);
1108+
return updatedPullRequest;
1109+
}
1110+
1111+
/// force an update to an existing pull request
1112+
private async updateExistingPullRequest(
1113+
existing: PullRequest,
1114+
pullRequest: ReleasePullRequest
1115+
): Promise<PullRequest> {
1116+
return await this.github.updatePullRequest(
1117+
existing.number,
11041118
pullRequest,
11051119
this.targetBranch,
11061120
{
@@ -1109,9 +1123,6 @@ export class Manifest {
11091123
pullRequestOverflowHandler: this.pullRequestOverflowHandler,
11101124
}
11111125
);
1112-
// TODO: consider leaving the snooze label
1113-
await this.github.removeIssueLabels([SNOOZE_LABEL], snoozed.number);
1114-
return updatedPullRequest;
11151126
}
11161127

11171128
private async *findMergedReleasePullRequests() {
@@ -1434,6 +1445,7 @@ async function parseConfig(
14341445
lastReleaseSha: config['last-release-sha'],
14351446
alwaysLinkLocal: config['always-link-local'],
14361447
separatePullRequests: config['separate-pull-requests'],
1448+
alwaysUpdate: config['always-update'],
14371449
groupPullRequestTitlePattern: config['group-pull-request-title-pattern'],
14381450
plugins: config['plugins'],
14391451
signoff: config['signoff'],

test/manifest.ts

+83
Original file line numberDiff line numberDiff line change
@@ -4332,6 +4332,89 @@ describe('Manifest', () => {
43324332
const pullRequestNumbers = await manifest.createPullRequests();
43334333
expect(pullRequestNumbers).lengthOf(0);
43344334
});
4335+
4336+
it('updates an existing pull request without changes if set to always update', async function () {
4337+
sandbox
4338+
.stub(github, 'getFileContentsOnBranch')
4339+
.withArgs('README.md', 'main')
4340+
.resolves(buildGitHubFileRaw('some-content'))
4341+
.withArgs('release-notes.md', 'my-head-branch--release-notes')
4342+
.resolves(buildGitHubFileRaw(body.toString()));
4343+
stubSuggesterWithSnapshot(sandbox, this.test!.fullTitle());
4344+
mockPullRequests(
4345+
github,
4346+
[
4347+
{
4348+
number: 22,
4349+
title: 'pr title1',
4350+
body: pullRequestBody('release-notes/overflow.txt'),
4351+
headBranchName: 'release-please/branches/main',
4352+
baseBranchName: 'main',
4353+
labels: ['autorelease: pending'],
4354+
files: [],
4355+
},
4356+
],
4357+
[]
4358+
);
4359+
sandbox
4360+
.stub(github, 'updatePullRequest')
4361+
.withArgs(
4362+
22,
4363+
sinon.match.any,
4364+
sinon.match.any,
4365+
sinon.match.has('pullRequestOverflowHandler', sinon.match.truthy)
4366+
)
4367+
.resolves({
4368+
number: 22,
4369+
title: 'pr title1',
4370+
body: 'pr body1',
4371+
headBranchName: 'release-please/branches/main',
4372+
baseBranchName: 'main',
4373+
labels: [],
4374+
files: [],
4375+
});
4376+
const manifest = new Manifest(
4377+
github,
4378+
'main',
4379+
{
4380+
'path/a': {
4381+
releaseType: 'node',
4382+
component: 'pkg1',
4383+
},
4384+
'path/b': {
4385+
releaseType: 'node',
4386+
component: 'pkg2',
4387+
},
4388+
},
4389+
{
4390+
'path/a': Version.parse('1.0.0'),
4391+
'path/b': Version.parse('0.2.3'),
4392+
},
4393+
{
4394+
separatePullRequests: true,
4395+
alwaysUpdate: true,
4396+
plugins: ['node-workspace'],
4397+
}
4398+
);
4399+
sandbox.stub(manifest, 'buildPullRequests').resolves([
4400+
{
4401+
title: PullRequestTitle.ofTargetBranch('main'),
4402+
body,
4403+
updates: [
4404+
{
4405+
path: 'README.md',
4406+
createIfMissing: false,
4407+
updater: new RawContent('some raw content'),
4408+
},
4409+
],
4410+
labels: [],
4411+
headRefName: 'release-please/branches/main',
4412+
draft: false,
4413+
},
4414+
]);
4415+
const pullRequestNumbers = await manifest.createPullRequests();
4416+
expect(pullRequestNumbers).lengthOf(1);
4417+
});
43354418
});
43364419

43374420
it('updates an existing snapshot pull request', async function () {

0 commit comments

Comments
 (0)