release-please 13.2.0 → 13.2.1

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,13 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/release-please?activeTab=versions
6
6
 
7
+ ### [13.2.1](https://github.com/googleapis/release-please/compare/v13.2.0...v13.2.1) (2022-01-12)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **php-yoshi:** fix parsing of pull request body ([#1213](https://github.com/googleapis/release-please/issues/1213)) ([00702ca](https://github.com/googleapis/release-please/commit/00702ca575e5d134505280b436e1348eccb2de01))
13
+
7
14
  ## [13.2.0](https://github.com/googleapis/release-please/compare/v13.1.1...v13.2.0) (2022-01-11)
8
15
 
9
16
 
@@ -9,6 +9,7 @@ import { Version, VersionsMap } from '../version';
9
9
  import { TagName } from '../util/tag-name';
10
10
  import { Release } from '../release';
11
11
  import { ReleasePullRequest } from '../release-pull-request';
12
+ import { PullRequestBody } from '../util/pull-request-body';
12
13
  import { PullRequest } from '../pull-request';
13
14
  export interface BuildUpdatesOptions {
14
15
  changelogEntry: string;
@@ -97,6 +98,7 @@ export declare abstract class BaseStrategy implements Strategy {
97
98
  protected updateVersionsMap(versionsMap: VersionsMap, conventionalCommits: ConventionalCommit[]): Promise<VersionsMap>;
98
99
  protected buildNewVersion(conventionalCommits: ConventionalCommit[], latestRelease?: Release): Promise<Version>;
99
100
  protected buildVersionsMap(_conventionalCommits: ConventionalCommit[]): Promise<VersionsMap>;
101
+ protected parsePullRequestBody(pullRequestBody: string): Promise<PullRequestBody | undefined>;
100
102
  /**
101
103
  * Given a merged pull request, build the candidate release.
102
104
  * @param {PullRequest} mergedPullRequest The merged release pull request.
@@ -188,6 +188,9 @@ class BaseStrategy {
188
188
  async buildVersionsMap(_conventionalCommits) {
189
189
  return new Map();
190
190
  }
191
+ async parsePullRequestBody(pullRequestBody) {
192
+ return pull_request_body_1.PullRequestBody.parse(pullRequestBody);
193
+ }
191
194
  /**
192
195
  * Given a merged pull request, build the candidate release.
193
196
  * @param {PullRequest} mergedPullRequest The merged release pull request.
@@ -213,7 +216,7 @@ class BaseStrategy {
213
216
  logger_1.logger.error(`Bad branch name: ${mergedPullRequest.headBranchName}`);
214
217
  return;
215
218
  }
216
- const pullRequestBody = pull_request_body_1.PullRequestBody.parse(mergedPullRequest.body);
219
+ const pullRequestBody = await this.parsePullRequestBody(mergedPullRequest.body);
217
220
  if (!pullRequestBody) {
218
221
  logger_1.logger.error('Could not parse pull request body as a release PR');
219
222
  return;
@@ -3,8 +3,10 @@ import { Update } from '../update';
3
3
  import { Commit } from '../commit';
4
4
  import { Release } from '../release';
5
5
  import { ReleasePullRequest } from '../release-pull-request';
6
+ import { PullRequestBody } from '../util/pull-request-body';
6
7
  export declare class PHPYoshi extends BaseStrategy {
7
8
  constructor(options: BaseStrategyOptions);
8
9
  buildReleasePullRequest(commits: Commit[], latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest>;
10
+ protected parsePullRequestBody(pullRequestBody: string): Promise<PullRequestBody | undefined>;
9
11
  protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
10
12
  }
@@ -146,6 +146,23 @@ class PHPYoshi extends base_1.BaseStrategy {
146
146
  draft: draft !== null && draft !== void 0 ? draft : false,
147
147
  };
148
148
  }
149
+ async parsePullRequestBody(pullRequestBody) {
150
+ const body = pull_request_body_1.PullRequestBody.parse(pullRequestBody);
151
+ if (!body) {
152
+ return undefined;
153
+ }
154
+ const component = await this.getComponent();
155
+ const notes = body.releaseData
156
+ .map(release => {
157
+ var _a;
158
+ return `<details><summary>${release.component}: ${(_a = release.version) === null || _a === void 0 ? void 0 : _a.toString()}</summary>\n\n${release.notes}\n</details>`;
159
+ })
160
+ .join('\n\n');
161
+ return new pull_request_body_1.PullRequestBody([{ component, notes }], {
162
+ footer: body.footer,
163
+ header: body.header,
164
+ });
165
+ }
149
166
  async buildUpdates(options) {
150
167
  const updates = [];
151
168
  const version = options.newVersion;
@@ -87,7 +87,7 @@ function splitBody(body) {
87
87
  content,
88
88
  };
89
89
  }
90
- const SUMMARY_PATTERN = /^(?<component>.*): (?<version>\d+\.\d+\.\d+.*)$/;
90
+ const SUMMARY_PATTERN = /^(?<component>.*[^:]):? (?<version>\d+\.\d+\.\d+.*)$/;
91
91
  function extractMultipleReleases(notes) {
92
92
  const data = [];
93
93
  const root = node_html_parser_1.parse(notes);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "13.2.0",
3
+ "version": "13.2.1",
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",
@@ -41,7 +41,7 @@
41
41
  "@types/chai": "^4.1.7",
42
42
  "@types/iarna__toml": "^2.0.1",
43
43
  "@types/js-yaml": "^4.0.0",
44
- "@types/mocha": "^8.0.0",
44
+ "@types/mocha": "^9.0.0",
45
45
  "@types/node": "^16.0.0",
46
46
  "@types/pino": "^7.0.0",
47
47
  "@types/semver": "^7.0.0",
@@ -51,7 +51,7 @@
51
51
  "chai": "^4.2.0",
52
52
  "cross-env": "^7.0.0",
53
53
  "gts": "^3.0.0",
54
- "mocha": "^8.0.0",
54
+ "mocha": "^9.0.0",
55
55
  "nock": "^13.0.0",
56
56
  "sinon": "12.0.1",
57
57
  "snap-shot-it": "^7.0.0"