release-please 13.11.1 → 13.14.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 CHANGED
@@ -4,6 +4,32 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ## [13.14.0](https://github.com/googleapis/release-please/compare/v13.13.0...v13.14.0) (2022-04-20)
8
+
9
+
10
+ ### Features
11
+
12
+ * Support sequential-calls manifest field that disables concurrency when creating multiple pull requests or releases ([#1401](https://github.com/googleapis/release-please/issues/1401)) ([50f5c99](https://github.com/googleapis/release-please/commit/50f5c990b99d991b874ba88556386c6b940743f6))
13
+
14
+ ## [13.13.0](https://github.com/googleapis/release-please/compare/v13.12.0...v13.13.0) (2022-04-18)
15
+
16
+
17
+ ### Features
18
+
19
+ * add a flag to disable adding labels to new pull requests ([#1399](https://github.com/googleapis/release-please/issues/1399)) ([3957ef5](https://github.com/googleapis/release-please/commit/3957ef542512eb1ae2c3353b3c2a7fde4540c731))
20
+
21
+ ## [13.12.0](https://github.com/googleapis/release-please/compare/v13.11.1...v13.12.0) (2022-04-15)
22
+
23
+
24
+ ### Features
25
+
26
+ * allow configuring `release-search-depth` and `commit-search-depth` ([#1396](https://github.com/googleapis/release-please/issues/1396)) ([102d650](https://github.com/googleapis/release-please/commit/102d650394140667d17d84726bd962477d69562c)), closes [#1394](https://github.com/googleapis/release-please/issues/1394)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * Allow an empty value for --label ([#1397](https://github.com/googleapis/release-please/issues/1397)) ([f5aff97](https://github.com/googleapis/release-please/commit/f5aff97dbb20086a26b846dde89b289a4540dba1))
32
+
7
33
  ### [13.11.1](https://github.com/googleapis/release-please/compare/v13.11.0...v13.11.1) (2022-04-15)
8
34
 
9
35
 
@@ -48,6 +48,7 @@ interface ReleaseArgs {
48
48
  interface PullRequestArgs {
49
49
  draftPullRequest?: boolean;
50
50
  label?: string;
51
+ skipLabeling?: boolean;
51
52
  signoff?: string;
52
53
  }
53
54
  interface PullRequestStrategyArgs {
@@ -105,6 +105,11 @@ function pullRequestOptions(yargs) {
105
105
  .option('label', {
106
106
  default: 'autorelease: pending',
107
107
  describe: 'comma-separated list of labels to add to from release PR',
108
+ })
109
+ .option('skip-labeling', {
110
+ describe: 'skip application of labels to pull requests',
111
+ type: 'boolean',
112
+ default: false,
108
113
  })
109
114
  .option('fork', {
110
115
  describe: 'should the PR be created from a fork',
@@ -516,8 +521,14 @@ function extractManifestOptions(argv) {
516
521
  if ('fork' in argv && argv.fork !== undefined) {
517
522
  manifestOptions.fork = argv.fork;
518
523
  }
519
- if (argv.label) {
520
- manifestOptions.labels = argv.label.split(',');
524
+ if (argv.label !== undefined) {
525
+ let labels = argv.label.split(',');
526
+ if (labels.length === 1 && labels[0] === '')
527
+ labels = [];
528
+ manifestOptions.labels = labels;
529
+ }
530
+ if ('skipLabeling' in argv && argv.skipLabeling !== undefined) {
531
+ manifestOptions.skipLabeling = argv.skipLabeling;
521
532
  }
522
533
  if ('releaseLabel' in argv && argv.releaseLabel) {
523
534
  manifestOptions.releaseLabels = argv.releaseLabel.split(',');
@@ -233,6 +233,7 @@ export declare class GitHub {
233
233
  createReleasePullRequest(releasePullRequest: ReleasePullRequest, targetBranch: string, options?: {
234
234
  signoffUser?: string;
235
235
  fork?: boolean;
236
+ skipLabeling?: boolean;
236
237
  }): Promise<PullRequest>;
237
238
  createPullRequest: (pullRequest: PullRequest, targetBranch: string, message: string, updates: Update[], options?: {
238
239
  fork?: boolean | undefined;
@@ -870,13 +870,15 @@ class GitHub {
870
870
  if (options === null || options === void 0 ? void 0 : options.signoffUser) {
871
871
  message = signoff_commit_message_1.signoffCommitMessage(message, options.signoffUser);
872
872
  }
873
+ const pullRequestLabels = (options === null || options === void 0 ? void 0 : options.skipLabeling) ? []
874
+ : releasePullRequest.labels;
873
875
  return await this.createPullRequest({
874
876
  headBranchName: releasePullRequest.headRefName,
875
877
  baseBranchName: targetBranch,
876
878
  number: -1,
877
879
  title: releasePullRequest.title.toString(),
878
880
  body: releasePullRequest.body.toString().slice(0, MAX_ISSUE_BODY_SIZE),
879
- labels: releasePullRequest.labels,
881
+ labels: pullRequestLabels,
880
882
  files: [],
881
883
  }, targetBranch, message, releasePullRequest.updates, {
882
884
  fork: options === null || options === void 0 ? void 0 : options.fork,
@@ -90,10 +90,14 @@ export interface ManifestOptions {
90
90
  labels?: string[];
91
91
  releaseLabels?: string[];
92
92
  snapshotLabels?: string[];
93
+ skipLabeling?: boolean;
94
+ sequentialCalls?: boolean;
93
95
  draft?: boolean;
94
96
  prerelease?: boolean;
95
97
  draftPullRequest?: boolean;
96
98
  groupPullRequestTitlePattern?: string;
99
+ releaseSearchDepth?: number;
100
+ commitSearchDepth?: number;
97
101
  }
98
102
  interface ReleaserPackageConfig extends ReleaserConfigJson {
99
103
  'package-name'?: string;
@@ -121,6 +125,9 @@ export interface ManifestConfig extends ReleaserConfigJson {
121
125
  plugins?: PluginType[];
122
126
  'separate-pull-requests'?: boolean;
123
127
  'group-pull-request-title-pattern'?: string;
128
+ 'release-search-depth'?: number;
129
+ 'commit-search-depth'?: number;
130
+ 'sequential-calls'?: boolean;
124
131
  }
125
132
  export declare type ReleasedVersions = Record<string, Version>;
126
133
  export declare type RepositoryConfig = Record<string, ReleaserConfig>;
@@ -150,6 +157,8 @@ export declare class Manifest {
150
157
  readonly fork: boolean;
151
158
  private signoffUser?;
152
159
  private labels;
160
+ private skipLabeling?;
161
+ private sequentialCalls?;
153
162
  private releaseLabels;
154
163
  private snapshotLabels;
155
164
  private plugins;
@@ -162,6 +171,8 @@ export declare class Manifest {
162
171
  private prerelease?;
163
172
  private draftPullRequest?;
164
173
  private groupPullRequestTitlePattern?;
174
+ readonly releaseSearchDepth: number;
175
+ readonly commitSearchDepth: number;
165
176
  /**
166
177
  * Create a Manifest from explicit config in code. This assumes that the
167
178
  * repository has a single component at the root path.
@@ -239,7 +250,7 @@ export declare class Manifest {
239
250
  /**
240
251
  * Opens/updates all candidate release pull requests for this repository.
241
252
  *
242
- * @returns {number[]} Pull request numbers of release pull requests
253
+ * @returns {PullRequest[]} Pull request numbers of release pull requests
243
254
  */
244
255
  createPullRequests(): Promise<(PullRequest | undefined)[]>;
245
256
  private findOpenReleasePullRequests;
@@ -33,6 +33,8 @@ exports.DEFAULT_LABELS = ['autorelease: pending'];
33
33
  exports.DEFAULT_RELEASE_LABELS = ['autorelease: tagged'];
34
34
  exports.DEFAULT_SNAPSHOT_LABELS = ['autorelease: snapshot'];
35
35
  exports.SNOOZE_LABEL = 'autorelease: snooze';
36
+ const DEFAULT_RELEASE_SEARCH_DEPTH = 400;
37
+ const DEFAULT_COMMIT_SEARCH_DEPTH = 500;
36
38
  exports.MANIFEST_PULL_REQUEST_TITLE_PATTERN = 'chore: release ${branch}';
37
39
  class Manifest {
38
40
  /**
@@ -76,6 +78,8 @@ class Manifest {
76
78
  this.releaseLabels =
77
79
  (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.releaseLabels) || exports.DEFAULT_RELEASE_LABELS;
78
80
  this.labels = (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.labels) || exports.DEFAULT_LABELS;
81
+ this.skipLabeling = (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.skipLabeling) || false;
82
+ this.sequentialCalls = (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.sequentialCalls) || false;
79
83
  this.snapshotLabels =
80
84
  (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.snapshotLabels) || exports.DEFAULT_SNAPSHOT_LABELS;
81
85
  this.bootstrapSha = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.bootstrapSha;
@@ -83,6 +87,10 @@ class Manifest {
83
87
  this.draft = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.draft;
84
88
  this.draftPullRequest = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.draftPullRequest;
85
89
  this.groupPullRequestTitlePattern = manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.groupPullRequestTitlePattern;
90
+ this.releaseSearchDepth =
91
+ (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.releaseSearchDepth) || DEFAULT_RELEASE_SEARCH_DEPTH;
92
+ this.commitSearchDepth =
93
+ (manifestOptions === null || manifestOptions === void 0 ? void 0 : manifestOptions.commitSearchDepth) || DEFAULT_COMMIT_SEARCH_DEPTH;
86
94
  }
87
95
  /**
88
96
  * Create a Manifest from config files in the repository.
@@ -169,8 +177,9 @@ class Manifest {
169
177
  const releaseShasByPath = {};
170
178
  // Releases by path
171
179
  const releasesByPath = {};
180
+ logger_1.logger.debug(`release search depth: ${this.releaseSearchDepth}`);
172
181
  for await (const release of this.github.releaseIterator({
173
- maxResults: 400,
182
+ maxResults: this.releaseSearchDepth,
174
183
  })) {
175
184
  const tagName = tag_name_1.TagName.parse(release.tagName);
176
185
  if (!tagName) {
@@ -227,8 +236,9 @@ class Manifest {
227
236
  // seen all release commits
228
237
  logger_1.logger.info('Collecting commits since all latest releases');
229
238
  const commits = [];
239
+ logger_1.logger.debug(`commit search depth: ${this.commitSearchDepth}`);
230
240
  const commitGenerator = this.github.mergeCommitIterator(this.targetBranch, {
231
- maxResults: 500,
241
+ maxResults: this.commitSearchDepth,
232
242
  backfillFiles: true,
233
243
  });
234
244
  const releaseShas = new Set(Object.values(releaseShasByPath));
@@ -391,7 +401,7 @@ class Manifest {
391
401
  /**
392
402
  * Opens/updates all candidate release pull requests for this repository.
393
403
  *
394
- * @returns {number[]} Pull request numbers of release pull requests
404
+ * @returns {PullRequest[]} Pull request numbers of release pull requests
395
405
  */
396
406
  async createPullRequests() {
397
407
  const candidatePullRequests = await this.buildPullRequests();
@@ -408,13 +418,24 @@ class Manifest {
408
418
  // collect open and snoozed release pull requests
409
419
  const openPullRequests = await this.findOpenReleasePullRequests();
410
420
  const snoozedPullRequests = await this.findSnoozedReleasePullRequests();
411
- const promises = [];
412
- for (const pullRequest of candidatePullRequests) {
413
- promises.push(this.createOrUpdatePullRequest(pullRequest, openPullRequests, snoozedPullRequests));
421
+ if (this.sequentialCalls) {
422
+ const pullRequests = [];
423
+ for (const pullRequest of candidatePullRequests) {
424
+ const resultPullRequest = await this.createOrUpdatePullRequest(pullRequest, openPullRequests, snoozedPullRequests);
425
+ if (resultPullRequest)
426
+ pullRequests.push(resultPullRequest);
427
+ }
428
+ return pullRequests;
429
+ }
430
+ else {
431
+ const promises = [];
432
+ for (const pullRequest of candidatePullRequests) {
433
+ promises.push(this.createOrUpdatePullRequest(pullRequest, openPullRequests, snoozedPullRequests));
434
+ }
435
+ const pullNumbers = await Promise.all(promises);
436
+ // reject any pull numbers that were not created or updated
437
+ return pullNumbers.filter(number => !!number);
414
438
  }
415
- const pullNumbers = await Promise.all(promises);
416
- // reject any pull numbers that were not created or updated
417
- return pullNumbers.filter(number => !!number);
418
439
  }
419
440
  async findOpenReleasePullRequests() {
420
441
  logger_1.logger.info('Looking for open release pull requests');
@@ -459,6 +480,7 @@ class Manifest {
459
480
  const newPullRequest = await this.github.createReleasePullRequest(pullRequest, this.targetBranch, {
460
481
  fork: this.fork,
461
482
  signoffUser: this.signoffUser,
483
+ skipLabeling: this.skipLabeling,
462
484
  });
463
485
  return newPullRequest;
464
486
  }
@@ -563,12 +585,22 @@ class Manifest {
563
585
  releasesByPullRequest[release.pullRequest.number] = [release];
564
586
  }
565
587
  }
566
- const promises = [];
567
- for (const pullNumber in releasesByPullRequest) {
568
- promises.push(this.createReleasesForPullRequest(releasesByPullRequest[pullNumber], pullRequestsByNumber[pullNumber]));
588
+ if (this.sequentialCalls) {
589
+ const resultReleases = [];
590
+ for (const pullNumber in releasesByPullRequest) {
591
+ const releases = await this.createReleasesForPullRequest(releasesByPullRequest[pullNumber], pullRequestsByNumber[pullNumber]);
592
+ resultReleases.concat(releases);
593
+ }
594
+ return resultReleases;
595
+ }
596
+ else {
597
+ const promises = [];
598
+ for (const pullNumber in releasesByPullRequest) {
599
+ promises.push(this.createReleasesForPullRequest(releasesByPullRequest[pullNumber], pullRequestsByNumber[pullNumber]));
600
+ }
601
+ const releases = await Promise.all(promises);
602
+ return releases.reduce((collection, r) => collection.concat(r), []);
569
603
  }
570
- const releases = await Promise.all(promises);
571
- return releases.reduce((collection, r) => collection.concat(r), []);
572
604
  }
573
605
  async createReleasesForPullRequest(releases, pullRequest) {
574
606
  // create the release
@@ -719,6 +751,9 @@ async function parseConfig(github, configFile, branch, onlyPath, releaseAs) {
719
751
  labels: configLabel === undefined ? undefined : [configLabel],
720
752
  releaseLabels: configReleaseLabel === undefined ? undefined : [configReleaseLabel],
721
753
  snapshotLabels: configSnapshotLabel === undefined ? undefined : [configSnapshotLabel],
754
+ releaseSearchDepth: config['release-search-depth'],
755
+ commitSearchDepth: config['commit-search-depth'],
756
+ sequentialCalls: config['sequential-calls'],
722
757
  };
723
758
  return { config: repositoryConfig, options: manifestOptions };
724
759
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "13.11.1",
3
+ "version": "13.14.0",
4
4
  "description": "generate release PRs based on the conventionalcommits.org spec",
5
5
  "main": "./build/src/index.js",
6
6
  "bin": "./build/src/bin/release-please.js",