release-please 13.6.0 → 13.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/build/src/changelog-notes.d.ts +2 -1
- package/build/src/manifest.d.ts +4 -0
- package/build/src/manifest.js +67 -23
- package/build/src/strategies/base.d.ts +1 -1
- package/build/src/strategies/base.js +3 -2
- package/build/src/strategies/go-yoshi.d.ts +2 -2
- package/build/src/strategies/go-yoshi.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
## [13.7.0](https://github.com/googleapis/release-please/compare/v13.6.0...v13.7.0) (2022-03-24)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* allow snoozing release pull requests ([#1345](https://github.com/googleapis/release-please/issues/1345)) ([ea69708](https://github.com/googleapis/release-please/commit/ea6970813a11cebe2394c19d8d006d352c8fb306)), closes [#1339](https://github.com/googleapis/release-please/issues/1339)
|
|
13
|
+
|
|
7
14
|
## [13.6.0](https://github.com/googleapis/release-please/compare/v13.5.0...v13.6.0) (2022-03-16)
|
|
8
15
|
|
|
9
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConventionalCommit } from './commit';
|
|
1
|
+
import { Commit, ConventionalCommit } from './commit';
|
|
2
2
|
export interface BuildNotesOptions {
|
|
3
3
|
host?: string;
|
|
4
4
|
owner: string;
|
|
@@ -8,6 +8,7 @@ export interface BuildNotesOptions {
|
|
|
8
8
|
currentTag: string;
|
|
9
9
|
targetBranch: string;
|
|
10
10
|
changelogSections?: ChangelogSection[];
|
|
11
|
+
commits?: Commit[];
|
|
11
12
|
}
|
|
12
13
|
export interface ChangelogNotes {
|
|
13
14
|
buildNotes(commits: ConventionalCommit[], options: BuildNotesOptions): Promise<string>;
|
package/build/src/manifest.d.ts
CHANGED
|
@@ -223,7 +223,11 @@ export declare class Manifest {
|
|
|
223
223
|
* @returns {number[]} Pull request numbers of release pull requests
|
|
224
224
|
*/
|
|
225
225
|
createPullRequests(): Promise<(PullRequest | undefined)[]>;
|
|
226
|
+
private findOpenReleasePullRequests;
|
|
227
|
+
private findSnoozedReleasePullRequests;
|
|
226
228
|
private createOrUpdatePullRequest;
|
|
229
|
+
private maybeUpdateExistingPullRequest;
|
|
230
|
+
private maybeUpdateSnoozedPullRequest;
|
|
227
231
|
private findMergedReleasePullRequests;
|
|
228
232
|
/**
|
|
229
233
|
* Find merged, untagged releases and build candidate releases to tag.
|
package/build/src/manifest.js
CHANGED
|
@@ -31,6 +31,7 @@ exports.ROOT_PROJECT_PATH = '.';
|
|
|
31
31
|
const DEFAULT_COMPONENT_NAME = '';
|
|
32
32
|
const DEFAULT_LABELS = ['autorelease: pending'];
|
|
33
33
|
const DEFAULT_RELEASE_LABELS = ['autorelease: tagged'];
|
|
34
|
+
const SNOOZE_LABEL = 'autorelease: snooze';
|
|
34
35
|
exports.MANIFEST_PULL_REQUEST_TITLE_PATTERN = 'chore: release ${branch}';
|
|
35
36
|
class Manifest {
|
|
36
37
|
/**
|
|
@@ -398,7 +399,18 @@ class Manifest {
|
|
|
398
399
|
logger_1.logger.warn('There are untagged, merged release PRs outstanding - aborting');
|
|
399
400
|
return [];
|
|
400
401
|
}
|
|
401
|
-
// collect open release pull requests
|
|
402
|
+
// collect open and snoozed release pull requests
|
|
403
|
+
const openPullRequests = await this.findOpenReleasePullRequests();
|
|
404
|
+
const snoozedPullRequests = await this.findSnoozedReleasePullRequests();
|
|
405
|
+
const promises = [];
|
|
406
|
+
for (const pullRequest of candidatePullRequests) {
|
|
407
|
+
promises.push(this.createOrUpdatePullRequest(pullRequest, openPullRequests, snoozedPullRequests));
|
|
408
|
+
}
|
|
409
|
+
const pullNumbers = await Promise.all(promises);
|
|
410
|
+
// reject any pull numbers that were not created or updated
|
|
411
|
+
return pullNumbers.filter(number => !!number);
|
|
412
|
+
}
|
|
413
|
+
async findOpenReleasePullRequests() {
|
|
402
414
|
logger_1.logger.info('Looking for open release pull requests');
|
|
403
415
|
const openPullRequests = [];
|
|
404
416
|
const generator = this.github.pullRequestIterator(this.targetBranch, 'OPEN');
|
|
@@ -410,34 +422,66 @@ class Manifest {
|
|
|
410
422
|
}
|
|
411
423
|
}
|
|
412
424
|
logger_1.logger.info(`found ${openPullRequests.length} open release pull requests.`);
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
425
|
+
return openPullRequests;
|
|
426
|
+
}
|
|
427
|
+
async findSnoozedReleasePullRequests() {
|
|
428
|
+
logger_1.logger.info('Looking for snoozed release pull requests');
|
|
429
|
+
const snoozedPullRequests = [];
|
|
430
|
+
const closedGenerator = this.github.pullRequestIterator(this.targetBranch, 'CLOSED');
|
|
431
|
+
for await (const closedPullRequest of closedGenerator) {
|
|
432
|
+
if (hasAllLabels([SNOOZE_LABEL], closedPullRequest.labels) &&
|
|
433
|
+
branch_name_1.BranchName.parse(closedPullRequest.headBranchName) &&
|
|
434
|
+
pull_request_body_1.PullRequestBody.parse(closedPullRequest.body)) {
|
|
435
|
+
snoozedPullRequests.push(closedPullRequest);
|
|
436
|
+
}
|
|
416
437
|
}
|
|
417
|
-
|
|
438
|
+
logger_1.logger.info(`found ${snoozedPullRequests.length} snoozed release pull requests.`);
|
|
439
|
+
return snoozedPullRequests;
|
|
418
440
|
}
|
|
419
|
-
async createOrUpdatePullRequest(pullRequest, openPullRequests) {
|
|
420
|
-
// look for existing, open pull
|
|
441
|
+
async createOrUpdatePullRequest(pullRequest, openPullRequests, snoozedPullRequests) {
|
|
442
|
+
// look for existing, open pull request
|
|
421
443
|
const existing = openPullRequests.find(openPullRequest => openPullRequest.headBranchName === pullRequest.headRefName);
|
|
422
444
|
if (existing) {
|
|
423
|
-
|
|
424
|
-
if (existing.body === pullRequest.body.toString()) {
|
|
425
|
-
logger_1.logger.info(`PR https://github.com/${this.repository.owner}/${this.repository.repo}/pull/${existing.number} remained the same`);
|
|
426
|
-
return undefined;
|
|
427
|
-
}
|
|
428
|
-
const updatedPullRequest = await this.github.updatePullRequest(existing.number, pullRequest, this.targetBranch, {
|
|
429
|
-
fork: this.fork,
|
|
430
|
-
signoffUser: this.signoffUser,
|
|
431
|
-
});
|
|
432
|
-
return updatedPullRequest;
|
|
445
|
+
return await this.maybeUpdateExistingPullRequest(existing, pullRequest);
|
|
433
446
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
});
|
|
439
|
-
return newPullRequest;
|
|
447
|
+
// look for closed, snoozed pull request
|
|
448
|
+
const snoozed = snoozedPullRequests.find(openPullRequest => openPullRequest.headBranchName === pullRequest.headRefName);
|
|
449
|
+
if (snoozed) {
|
|
450
|
+
return await this.maybeUpdateSnoozedPullRequest(snoozed, pullRequest);
|
|
440
451
|
}
|
|
452
|
+
const newPullRequest = await this.github.createReleasePullRequest(pullRequest, this.targetBranch, {
|
|
453
|
+
fork: this.fork,
|
|
454
|
+
signoffUser: this.signoffUser,
|
|
455
|
+
});
|
|
456
|
+
return newPullRequest;
|
|
457
|
+
}
|
|
458
|
+
/// only update an existing pull request if it has release note changes
|
|
459
|
+
async maybeUpdateExistingPullRequest(existing, pullRequest) {
|
|
460
|
+
// If unchanged, no need to push updates
|
|
461
|
+
if (existing.body === pullRequest.body.toString()) {
|
|
462
|
+
logger_1.logger.info(`PR https://github.com/${this.repository.owner}/${this.repository.repo}/pull/${existing.number} remained the same`);
|
|
463
|
+
return undefined;
|
|
464
|
+
}
|
|
465
|
+
const updatedPullRequest = await this.github.updatePullRequest(existing.number, pullRequest, this.targetBranch, {
|
|
466
|
+
fork: this.fork,
|
|
467
|
+
signoffUser: this.signoffUser,
|
|
468
|
+
});
|
|
469
|
+
return updatedPullRequest;
|
|
470
|
+
}
|
|
471
|
+
/// only update an snoozed pull request if it has release note changes
|
|
472
|
+
async maybeUpdateSnoozedPullRequest(snoozed, pullRequest) {
|
|
473
|
+
// If unchanged, no need to push updates
|
|
474
|
+
if (snoozed.body === pullRequest.body.toString()) {
|
|
475
|
+
logger_1.logger.info(`PR https://github.com/${this.repository.owner}/${this.repository.repo}/pull/${snoozed.number} remained the same`);
|
|
476
|
+
return undefined;
|
|
477
|
+
}
|
|
478
|
+
const updatedPullRequest = await this.github.updatePullRequest(snoozed.number, pullRequest, this.targetBranch, {
|
|
479
|
+
fork: this.fork,
|
|
480
|
+
signoffUser: this.signoffUser,
|
|
481
|
+
});
|
|
482
|
+
// TODO: consider leaving the snooze label
|
|
483
|
+
await this.github.removeIssueLabels([SNOOZE_LABEL], snoozed.number);
|
|
484
|
+
return updatedPullRequest;
|
|
441
485
|
}
|
|
442
486
|
async *findMergedReleasePullRequests() {
|
|
443
487
|
// Find merged release pull requests
|
|
@@ -82,7 +82,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
82
82
|
* @returns {ConventionalCommit[]} modified commits
|
|
83
83
|
*/
|
|
84
84
|
protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
|
|
85
|
-
protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
|
|
85
|
+
protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release, commits?: Commit[]): Promise<string>;
|
|
86
86
|
protected buildPullRequestBody(component: string | undefined, newVersion: Version, releaseNotesBody: string, _conventionalCommits: ConventionalCommit[], _latestRelease?: Release): Promise<PullRequestBody>;
|
|
87
87
|
/**
|
|
88
88
|
* Builds a candidate release pull request
|
|
@@ -92,7 +92,7 @@ class BaseStrategy {
|
|
|
92
92
|
async postProcessCommits(commits) {
|
|
93
93
|
return commits;
|
|
94
94
|
}
|
|
95
|
-
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
|
|
95
|
+
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease, commits) {
|
|
96
96
|
var _a;
|
|
97
97
|
return await this.changelogNotes.buildNotes(conventionalCommits, {
|
|
98
98
|
owner: this.repository.owner,
|
|
@@ -102,6 +102,7 @@ class BaseStrategy {
|
|
|
102
102
|
currentTag: newVersionTag.toString(),
|
|
103
103
|
targetBranch: this.targetBranch,
|
|
104
104
|
changelogSections: this.changelogSections,
|
|
105
|
+
commits: commits,
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
async buildPullRequestBody(component, newVersion, releaseNotesBody, _conventionalCommits, _latestRelease) {
|
|
@@ -141,7 +142,7 @@ class BaseStrategy {
|
|
|
141
142
|
const branchName = component
|
|
142
143
|
? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
|
|
143
144
|
: branch_name_1.BranchName.ofTargetBranch(this.targetBranch);
|
|
144
|
-
const releaseNotesBody = await this.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease);
|
|
145
|
+
const releaseNotesBody = await this.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease, commits);
|
|
145
146
|
if (this.changelogEmpty(releaseNotesBody)) {
|
|
146
147
|
logger_1.logger.info(`No user facing commits found since ${latestRelease ? latestRelease.sha : 'beginning of time'} - skipping`);
|
|
147
148
|
return undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
|
|
2
2
|
import { Update } from '../update';
|
|
3
|
-
import { ConventionalCommit } from '../commit';
|
|
3
|
+
import { Commit, ConventionalCommit } from '../commit';
|
|
4
4
|
import { Version } from '../version';
|
|
5
5
|
import { TagName } from '../util/tag-name';
|
|
6
6
|
import { Release } from '../release';
|
|
@@ -9,6 +9,6 @@ export declare class GoYoshi extends BaseStrategy {
|
|
|
9
9
|
protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
|
|
10
10
|
protected postProcessCommits(commits: ConventionalCommit[]): Promise<ConventionalCommit[]>;
|
|
11
11
|
getIgnoredSubModules(): Promise<Set<string>>;
|
|
12
|
-
protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release): Promise<string>;
|
|
12
|
+
protected buildReleaseNotes(conventionalCommits: ConventionalCommit[], newVersion: Version, newVersionTag: TagName, latestRelease?: Release, commits?: Commit[]): Promise<string>;
|
|
13
13
|
protected initialReleaseVersion(): Version;
|
|
14
14
|
}
|
|
@@ -137,8 +137,8 @@ class GoYoshi extends base_1.BaseStrategy {
|
|
|
137
137
|
}
|
|
138
138
|
// "closes" is a little presumptuous, let's just indicate that the
|
|
139
139
|
// PR references these other commits:
|
|
140
|
-
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease) {
|
|
141
|
-
const releaseNotes = await super.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease);
|
|
140
|
+
async buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease, commits) {
|
|
141
|
+
const releaseNotes = await super.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease, commits);
|
|
142
142
|
return releaseNotes.replace(/, closes /g, ', refs ');
|
|
143
143
|
}
|
|
144
144
|
initialReleaseVersion() {
|