release-please 13.4.7 → 13.4.8

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,19 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ### [13.4.8](https://github.com/googleapis/release-please/compare/v13.4.7...v13.4.8) (2022-02-08)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * allow configuring includeComponentInTag and tagSeparator from manifest config ([71d9b6d](https://github.com/googleapis/release-please/commit/71d9b6d5775bb1a35157c7ec512ef4d1d9f7feec))
13
+ * check recent commits and latest releases for latest version ([#1267](https://github.com/googleapis/release-please/issues/1267)) ([f931842](https://github.com/googleapis/release-please/commit/f931842a117c97dd117f161c89beb1c9e2257fa2))
14
+ * correctly fetch full list of files ([71d9b6d](https://github.com/googleapis/release-please/commit/71d9b6d5775bb1a35157c7ec512ef4d1d9f7feec))
15
+ * **go-yoshi:** allows using go-yoshi with manifest ([#1287](https://github.com/googleapis/release-please/issues/1287)) ([71d9b6d](https://github.com/googleapis/release-please/commit/71d9b6d5775bb1a35157c7ec512ef4d1d9f7feec))
16
+ * **go-yoshi:** should not always skip modules ([71d9b6d](https://github.com/googleapis/release-please/commit/71d9b6d5775bb1a35157c7ec512ef4d1d9f7feec))
17
+ * Manifest should be able to find tagged versions without a release ([71d9b6d](https://github.com/googleapis/release-please/commit/71d9b6d5775bb1a35157c7ec512ef4d1d9f7feec))
18
+ * provide pull request to commit parser allow overrides ([#1285](https://github.com/googleapis/release-please/issues/1285)) ([e54028b](https://github.com/googleapis/release-please/commit/e54028bb39c4535f42b0b90c60b7f331847d005c))
19
+
7
20
  ### [13.4.7](https://github.com/googleapis/release-please/compare/v13.4.6...v13.4.7) (2022-02-02)
8
21
 
9
22
 
@@ -123,6 +123,7 @@ async function buildStrategy(options) {
123
123
  changelogNotes,
124
124
  pullRequestTitlePattern: options.pullRequestTitlePattern,
125
125
  extraFiles: options.extraFiles,
126
+ tagSeparator: options.tagSeparator,
126
127
  };
127
128
  switch (options.releaseType) {
128
129
  case 'ruby': {
@@ -37,13 +37,25 @@ class GitHub {
37
37
  */
38
38
  this.getCommitFiles = wrapAsync(async (sha) => {
39
39
  logger_1.logger.debug(`Backfilling file list for commit: ${sha}`);
40
- const resp = await this.octokit.repos.getCommit({
40
+ const files = [];
41
+ for await (const resp of this.octokit.paginate.iterator(this.octokit.repos.getCommit, {
41
42
  owner: this.repository.owner,
42
43
  repo: this.repository.repo,
43
44
  ref: sha,
44
- });
45
- const files = resp.data.files || [];
46
- return files.map(file => file.filename).filter(filename => !!filename);
45
+ })) {
46
+ for (const f of resp.data.files || []) {
47
+ if (f.filename) {
48
+ files.push(f.filename);
49
+ }
50
+ }
51
+ }
52
+ if (files.length >= 3000) {
53
+ logger_1.logger.warn(`Found ${files.length} files. This may not include all the files.`);
54
+ }
55
+ else {
56
+ logger_1.logger.debug(`Found ${files.length} files`);
57
+ }
58
+ return files;
47
59
  });
48
60
  this.graphqlRequest = wrapAsync(async (opts, maxRetries = 1) => {
49
61
  while (maxRetries >= 0) {
@@ -509,6 +521,7 @@ class GitHub {
509
521
  }
510
522
  }
511
523
  async mergeCommitsGraphQL(targetBranch, cursor, options = {}) {
524
+ var _a;
512
525
  logger_1.logger.debug(`Fetching merge commits on branch ${targetBranch} with cursor: ${cursor}`);
513
526
  const response = await this.graphqlRequest({
514
527
  query: `query pullRequestsSince($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $cursor: String) {
@@ -562,7 +575,7 @@ class GitHub {
562
575
  repo: this.repository.repo,
563
576
  num: 25,
564
577
  targetBranch,
565
- maxFilesChanged: 64,
578
+ maxFilesChanged: 100,
566
579
  });
567
580
  // if the branch does exist, return null
568
581
  if (!response.repository.ref) {
@@ -592,9 +605,15 @@ class GitHub {
592
605
  labels: pullRequest.labels.nodes.map(node => node.name),
593
606
  files,
594
607
  };
595
- // We cannot directly fetch files on commits via graphql, only provide file
596
- // information for commits with associated pull requests
597
- commit.files = files;
608
+ if (((_a = pullRequest.files.pageInfo) === null || _a === void 0 ? void 0 : _a.hasNextPage) && options.backfillFiles) {
609
+ logger_1.logger.info(`PR #${pullRequest.number} has many files, backfilling`);
610
+ commit.files = await this.getCommitFiles(graphCommit.sha);
611
+ }
612
+ else {
613
+ // We cannot directly fetch files on commits via graphql, only provide file
614
+ // information for commits with associated pull requests
615
+ commit.files = files;
616
+ }
598
617
  }
599
618
  else if (options.backfillFiles) {
600
619
  // In this case, there is no squashed merge commit. This could be a simple
@@ -22,6 +22,7 @@ export interface ReleaserConfig {
22
22
  packageName?: string;
23
23
  includeComponentInTag?: boolean;
24
24
  pullRequestTitlePattern?: string;
25
+ tagSeparator?: string;
25
26
  changelogSections?: ChangelogSection[];
26
27
  changelogPath?: string;
27
28
  changelogType?: ChangelogNotesType;
@@ -54,6 +55,7 @@ interface ReleaserConfigJson {
54
55
  'include-component-in-tag'?: boolean;
55
56
  'changelog-type'?: ChangelogNotesType;
56
57
  'pull-request-title-pattern'?: string;
58
+ 'tag-separator'?: string;
57
59
  'version-file'?: string;
58
60
  'extra-files'?: string[];
59
61
  }
@@ -196,6 +198,8 @@ export declare class Manifest {
196
198
  * @returns {ReleasePullRequest[]} The candidate pull requests to open or update.
197
199
  */
198
200
  buildPullRequests(): Promise<ReleasePullRequest[]>;
201
+ private backfillReleasesFromTags;
202
+ private getAllTags;
199
203
  /**
200
204
  * Opens/updates all candidate release pull requests for this repository.
201
205
  *
@@ -166,7 +166,6 @@ class Manifest {
166
166
  for await (const release of this.github.releaseIterator({
167
167
  maxResults: 400,
168
168
  })) {
169
- // logger.debug(release);
170
169
  const tagName = tag_name_1.TagName.parse(release.tagName);
171
170
  if (!tagName) {
172
171
  logger_1.logger.warn(`Unable to parse release name: ${release.name}`);
@@ -199,6 +198,18 @@ class Manifest {
199
198
  }
200
199
  }
201
200
  const needsBootstrap = releasesFound < expectedReleases;
201
+ if (releasesFound < expectedReleases) {
202
+ logger_1.logger.warn(`Expected ${expectedReleases} releases, only found ${releasesFound}`);
203
+ // Fall back to looking for missing releases using expected tags
204
+ const missingPaths = Object.keys(strategiesByPath).filter(path => !releasesByPath[path]);
205
+ logger_1.logger.warn(`Missing ${missingPaths.length} paths: ${missingPaths}`);
206
+ const missingReleases = await this.backfillReleasesFromTags(missingPaths, strategiesByPath);
207
+ for (const path in missingReleases) {
208
+ releaseShasByPath[path] = missingReleases[path].sha;
209
+ releasesByPath[path] = missingReleases[path];
210
+ releasesFound++;
211
+ }
212
+ }
202
213
  if (releasesFound < expectedReleases) {
203
214
  logger_1.logger.warn(`Expected ${expectedReleases} releases, only found ${releasesFound}`);
204
215
  }
@@ -246,6 +257,7 @@ class Manifest {
246
257
  sha: commit.sha,
247
258
  message: commit.message,
248
259
  files: commit.files,
260
+ pullRequest: commit.pullRequest,
249
261
  });
250
262
  }
251
263
  if (releaseCommitsFound < expectedShas) {
@@ -322,6 +334,38 @@ class Manifest {
322
334
  }
323
335
  return newReleasePullRequests.map(pullRequestWithConfig => pullRequestWithConfig.pullRequest);
324
336
  }
337
+ async backfillReleasesFromTags(missingPaths, strategiesByPath) {
338
+ const releasesByPath = {};
339
+ const allTags = await this.getAllTags();
340
+ for (const path of missingPaths) {
341
+ const expectedVersion = this.releasedVersions[path];
342
+ if (!expectedVersion) {
343
+ logger_1.logger.warn(`No version for path ${path}`);
344
+ continue;
345
+ }
346
+ const component = await strategiesByPath[path].getComponent();
347
+ const expectedTag = new tag_name_1.TagName(expectedVersion, component, this.repositoryConfig[path].tagSeparator);
348
+ logger_1.logger.debug(`looking for tagName: ${expectedTag.toString()}`);
349
+ const foundTag = allTags[expectedTag.toString()];
350
+ if (foundTag) {
351
+ logger_1.logger.debug(`found: ${foundTag.name} ${foundTag.sha}`);
352
+ releasesByPath[path] = {
353
+ name: foundTag.name,
354
+ tag: expectedTag,
355
+ sha: foundTag.sha,
356
+ notes: '',
357
+ };
358
+ }
359
+ }
360
+ return releasesByPath;
361
+ }
362
+ async getAllTags() {
363
+ const allTags = {};
364
+ for await (const tag of this.github.tagIterator()) {
365
+ allTags[tag.name] = tag;
366
+ }
367
+ return allTags;
368
+ }
325
369
  /**
326
370
  * Opens/updates all candidate release pull requests for this repository.
327
371
  *
@@ -567,6 +611,7 @@ function extractReleaserConfig(config) {
567
611
  includeComponentInTag: config['include-component-in-tag'],
568
612
  changelogType: config['changelog-type'],
569
613
  pullRequestTitlePattern: config['pull-request-title-pattern'],
614
+ tagSeparator: config['tag-separator'],
570
615
  };
571
616
  }
572
617
  /**
@@ -628,6 +673,7 @@ async function latestReleaseVersion(github, targetBranch, prefix, pullRequestTit
628
673
  // collect set of recent commit SHAs seen to verify that the release
629
674
  // is in the current branch
630
675
  const commitShas = new Set();
676
+ const candidateReleaseVersions = [];
631
677
  // only look at the last 250 or so commits to find the latest tag - we
632
678
  // don't want to scan the entire repository history if this repo has never
633
679
  // been released
@@ -656,12 +702,15 @@ async function latestReleaseVersion(github, targetBranch, prefix, pullRequestTit
656
702
  // FIXME, don't hardcode this
657
703
  continue;
658
704
  }
659
- return version;
705
+ if (version) {
706
+ logger_1.logger.debug(`Found latest release pull request: ${mergedPullRequest.number} version: ${version}`);
707
+ candidateReleaseVersions.push(version);
708
+ break;
709
+ }
660
710
  }
661
711
  // If not found from recent pull requests, look at releases. Iterate
662
712
  // through releases finding valid tags, then cross reference
663
713
  const releaseGenerator = github.releaseIterator();
664
- const candidateReleaseVersions = [];
665
714
  for await (const release of releaseGenerator) {
666
715
  const tagName = tag_name_1.TagName.parse(release.tagName);
667
716
  if (!tagName) {
@@ -703,7 +752,7 @@ async function latestReleaseVersion(github, targetBranch, prefix, pullRequestTit
703
752
  return candidateTagVersion.sort((a, b) => b.compare(a))[0];
704
753
  }
705
754
  function mergeReleaserConfig(defaultConfig, pathConfig) {
706
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
755
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
707
756
  return {
708
757
  releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
709
758
  bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
@@ -718,7 +767,9 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
718
767
  packageName: (_m = pathConfig.packageName) !== null && _m !== void 0 ? _m : defaultConfig.packageName,
719
768
  versionFile: (_o = pathConfig.versionFile) !== null && _o !== void 0 ? _o : defaultConfig.versionFile,
720
769
  extraFiles: (_p = pathConfig.extraFiles) !== null && _p !== void 0 ? _p : defaultConfig.extraFiles,
721
- pullRequestTitlePattern: (_q = pathConfig.pullRequestTitlePattern) !== null && _q !== void 0 ? _q : defaultConfig.pullRequestTitlePattern,
770
+ includeComponentInTag: (_q = pathConfig.includeComponentInTag) !== null && _q !== void 0 ? _q : defaultConfig.includeComponentInTag,
771
+ tagSeparator: (_r = pathConfig.tagSeparator) !== null && _r !== void 0 ? _r : defaultConfig.tagSeparator,
772
+ pullRequestTitlePattern: (_s = pathConfig.pullRequestTitlePattern) !== null && _s !== void 0 ? _s : defaultConfig.pullRequestTitlePattern,
722
773
  };
723
774
  }
724
775
  /**
@@ -66,10 +66,6 @@ class GoYoshi extends base_1.BaseStrategy {
66
66
  logger_1.logger.debug('Filtering commits');
67
67
  return commits.filter(commit => {
68
68
  var _a, _b;
69
- // ignore commits whose scope is in the list of ignored modules
70
- if (IGNORED_SUB_MODULES.has(commit.scope || '')) {
71
- return false;
72
- }
73
69
  // Only have a single entry of the nightly regen listed in the changelog.
74
70
  // If there are more than one of these commits, append associated PR.
75
71
  if (this.repository.owner === 'googleapis' &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "13.4.7",
3
+ "version": "13.4.8",
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",