release-please 14.1.2 → 14.2.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/commit.d.ts +2 -1
- package/build/src/commit.js +2 -2
- package/build/src/github.d.ts +3 -0
- package/build/src/github.js +29 -27
- package/build/src/manifest.d.ts +3 -0
- package/build/src/manifest.js +66 -65
- package/build/src/plugin.d.ts +3 -1
- package/build/src/plugin.js +3 -1
- package/build/src/plugins/cargo-workspace.js +9 -10
- package/build/src/plugins/linked-versions.d.ts +2 -0
- package/build/src/plugins/linked-versions.js +5 -6
- package/build/src/plugins/maven-workspace.js +14 -14
- package/build/src/plugins/merge.js +1 -2
- package/build/src/plugins/node-workspace.js +11 -12
- package/build/src/plugins/workspace.d.ts +3 -1
- package/build/src/plugins/workspace.js +20 -20
- package/build/src/strategies/base.d.ts +3 -0
- package/build/src/strategies/base.js +26 -24
- package/build/src/strategies/dotnet-yoshi.js +2 -3
- package/build/src/strategies/go-yoshi.js +7 -8
- package/build/src/strategies/java-yoshi.js +1 -2
- package/build/src/strategies/java.js +9 -8
- package/build/src/strategies/php-yoshi.js +4 -5
- package/build/src/strategies/python.js +2 -3
- package/build/src/strategies/rust.js +8 -9
- package/build/src/update.d.ts +2 -1
- package/build/src/updaters/dart/pubspec-yaml.d.ts +2 -1
- package/build/src/updaters/dart/pubspec-yaml.js +4 -4
- package/build/src/updaters/dotnet/apis.d.ts +2 -1
- package/build/src/updaters/dotnet/apis.js +2 -2
- package/build/src/updaters/elixir/elixir-mix-exs.d.ts +2 -1
- package/build/src/updaters/elixir/elixir-mix-exs.js +2 -2
- package/build/src/updaters/generic-json.d.ts +2 -1
- package/build/src/updaters/generic-json.js +2 -2
- package/build/src/updaters/generic-yaml.d.ts +2 -1
- package/build/src/updaters/generic-yaml.js +3 -3
- package/build/src/updaters/generic.d.ts +2 -1
- package/build/src/updaters/generic.js +2 -2
- package/build/src/updaters/helm/chart-yaml.d.ts +2 -1
- package/build/src/updaters/helm/chart-yaml.js +2 -2
- package/build/src/updaters/java/java-update.d.ts +2 -1
- package/build/src/updaters/java/java-update.js +2 -2
- package/build/src/updaters/java/versions-manifest.d.ts +2 -1
- package/build/src/updaters/java/versions-manifest.js +2 -2
- package/build/src/updaters/krm/krm-blueprint-version.d.ts +2 -1
- package/build/src/updaters/krm/krm-blueprint-version.js +2 -2
- package/build/src/updaters/node/package-json.d.ts +2 -1
- package/build/src/updaters/node/package-json.js +2 -2
- package/build/src/updaters/node/package-lock-json.d.ts +2 -1
- package/build/src/updaters/node/package-lock-json.js +2 -2
- package/build/src/updaters/node/samples-package-json.d.ts +2 -1
- package/build/src/updaters/node/samples-package-json.js +2 -2
- package/build/src/updaters/ocaml/dune-project.d.ts +2 -1
- package/build/src/updaters/ocaml/dune-project.js +2 -2
- package/build/src/updaters/ocaml/esy-json.d.ts +2 -1
- package/build/src/updaters/ocaml/esy-json.js +2 -2
- package/build/src/updaters/ocaml/opam.d.ts +2 -1
- package/build/src/updaters/ocaml/opam.js +2 -2
- package/build/src/updaters/php/php-manifest.d.ts +2 -1
- package/build/src/updaters/php/php-manifest.js +3 -3
- package/build/src/updaters/php/root-composer-update-packages.d.ts +2 -1
- package/build/src/updaters/php/root-composer-update-packages.js +3 -3
- package/build/src/updaters/python/pyproject-toml.d.ts +2 -1
- package/build/src/updaters/python/pyproject-toml.js +2 -2
- package/build/src/updaters/rust/cargo-lock.d.ts +2 -1
- package/build/src/updaters/rust/cargo-lock.js +3 -3
- package/build/src/updaters/rust/cargo-toml.d.ts +2 -1
- package/build/src/updaters/rust/cargo-toml.js +7 -7
- package/build/src/updaters/terraform/module-version.d.ts +2 -1
- package/build/src/updaters/terraform/module-version.js +2 -2
- package/build/src/util/branch-name.d.ts +2 -1
- package/build/src/util/branch-name.js +2 -2
- package/build/src/util/pull-request-body.d.ts +2 -1
- package/build/src/util/pull-request-body.js +9 -9
- package/build/src/util/pull-request-title.d.ts +3 -2
- package/build/src/util/pull-request-title.js +8 -7
- package/build/src/versioning-strategies/default.d.ts +3 -0
- package/build/src/versioning-strategies/default.js +3 -1
- 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
|
+
## [14.2.0](https://github.com/googleapis/release-please/compare/v14.1.2...v14.2.0) (2022-08-25)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* maintain an instance logger ([#1599](https://github.com/googleapis/release-please/issues/1599)) ([adb8053](https://github.com/googleapis/release-please/commit/adb805357d6344f1737bb3541ec7354e76f45cdc))
|
|
13
|
+
|
|
7
14
|
## [14.1.2](https://github.com/googleapis/release-please/compare/v14.1.1...v14.1.2) (2022-08-25)
|
|
8
15
|
|
|
9
16
|
|
package/build/src/commit.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PullRequest } from './pull-request';
|
|
2
|
+
import { Logger } from './util/logger';
|
|
2
3
|
import * as parser from '@conventional-commits/parser';
|
|
3
4
|
export interface Commit {
|
|
4
5
|
sha: string;
|
|
@@ -23,4 +24,4 @@ export interface ConventionalCommit extends Commit {
|
|
|
23
24
|
* more commits returned as a single raw commit may contain multiple release
|
|
24
25
|
* messages.
|
|
25
26
|
*/
|
|
26
|
-
export declare function parseConventionalCommits(commits: Commit[]): ConventionalCommit[];
|
|
27
|
+
export declare function parseConventionalCommits(commits: Commit[], logger?: Logger): ConventionalCommit[];
|
package/build/src/commit.js
CHANGED
|
@@ -292,7 +292,7 @@ function parseCommits(message) {
|
|
|
292
292
|
* more commits returned as a single raw commit may contain multiple release
|
|
293
293
|
* messages.
|
|
294
294
|
*/
|
|
295
|
-
function parseConventionalCommits(commits) {
|
|
295
|
+
function parseConventionalCommits(commits, logger = logger_1.logger) {
|
|
296
296
|
const conventionalCommits = [];
|
|
297
297
|
for (const commit of commits) {
|
|
298
298
|
const commitMessage = preprocessCommitMessage(commit);
|
|
@@ -315,7 +315,7 @@ function parseConventionalCommits(commits) {
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
catch (_err) {
|
|
318
|
-
|
|
318
|
+
logger.debug(`commit could not be parsed: ${commit.sha} ${commit.message.split('\n')[0]}`);
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
return conventionalCommits;
|
package/build/src/github.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ReleasePullRequest } from './release-pull-request';
|
|
|
10
10
|
import { Update } from './update';
|
|
11
11
|
import { Release } from './release';
|
|
12
12
|
import { GitHubFileContents } from '@google-automations/git-file-utils';
|
|
13
|
+
import { Logger } from 'code-suggester/build/src/types';
|
|
13
14
|
declare type RequestBuilderType = typeof request;
|
|
14
15
|
declare type DefaultFunctionType = RequestBuilderType['defaults'];
|
|
15
16
|
declare type RequestFunctionType = ReturnType<DefaultFunctionType>;
|
|
@@ -21,6 +22,7 @@ export interface OctokitAPIs {
|
|
|
21
22
|
export interface GitHubOptions {
|
|
22
23
|
repository: Repository;
|
|
23
24
|
octokitAPIs: OctokitAPIs;
|
|
25
|
+
logger?: Logger;
|
|
24
26
|
}
|
|
25
27
|
interface GitHubCreateOptions {
|
|
26
28
|
owner: string;
|
|
@@ -71,6 +73,7 @@ export declare class GitHub {
|
|
|
71
73
|
private request;
|
|
72
74
|
private graphql;
|
|
73
75
|
private fileCache;
|
|
76
|
+
private logger;
|
|
74
77
|
private constructor();
|
|
75
78
|
/**
|
|
76
79
|
* Build a new GitHub client with auto-detected default branch.
|
package/build/src/github.js
CHANGED
|
@@ -30,6 +30,7 @@ const signoff_commit_message_1 = require("./util/signoff-commit-message");
|
|
|
30
30
|
const git_file_utils_1 = require("@google-automations/git-file-utils");
|
|
31
31
|
class GitHub {
|
|
32
32
|
constructor(options) {
|
|
33
|
+
var _a;
|
|
33
34
|
/**
|
|
34
35
|
* Get the list of file paths modified in a given commit.
|
|
35
36
|
*
|
|
@@ -38,7 +39,7 @@ class GitHub {
|
|
|
38
39
|
* @throws {GitHubAPIError} on an API error
|
|
39
40
|
*/
|
|
40
41
|
this.getCommitFiles = wrapAsync(async (sha) => {
|
|
41
|
-
|
|
42
|
+
this.logger.debug(`Backfilling file list for commit: ${sha}`);
|
|
42
43
|
const files = [];
|
|
43
44
|
for await (const resp of this.octokit.paginate.iterator(this.octokit.repos.getCommit, {
|
|
44
45
|
owner: this.repository.owner,
|
|
@@ -52,10 +53,10 @@ class GitHub {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
if (files.length >= 3000) {
|
|
55
|
-
|
|
56
|
+
this.logger.warn(`Found ${files.length} files. This may not include all the files.`);
|
|
56
57
|
}
|
|
57
58
|
else {
|
|
58
|
-
|
|
59
|
+
this.logger.debug(`Found ${files.length} files`);
|
|
59
60
|
}
|
|
60
61
|
return files;
|
|
61
62
|
});
|
|
@@ -69,26 +70,26 @@ class GitHub {
|
|
|
69
70
|
if (response) {
|
|
70
71
|
return response;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
this.logger.trace('no GraphQL response, retrying');
|
|
73
74
|
}
|
|
74
75
|
catch (err) {
|
|
75
76
|
if (err.status !== 502) {
|
|
76
77
|
throw err;
|
|
77
78
|
}
|
|
78
79
|
if (maxRetries === 0) {
|
|
79
|
-
|
|
80
|
+
this.logger.warn('ran out of retries and response is required');
|
|
80
81
|
throw err;
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
+
this.logger.info(`received 502 error, ${maxRetries} attempts remaining`);
|
|
83
84
|
}
|
|
84
85
|
maxRetries -= 1;
|
|
85
86
|
if (maxRetries >= 0) {
|
|
86
|
-
|
|
87
|
+
this.logger.trace(`sleeping ${seconds} seconds`);
|
|
87
88
|
await (0, exports.sleepInMs)(1000 * seconds);
|
|
88
89
|
seconds = Math.min(seconds * 2, MAX_SLEEP_SECONDS);
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
|
-
|
|
92
|
+
this.logger.trace('ran out of retries');
|
|
92
93
|
return undefined;
|
|
93
94
|
});
|
|
94
95
|
/**
|
|
@@ -106,7 +107,7 @@ class GitHub {
|
|
|
106
107
|
if (prefix) {
|
|
107
108
|
prefix = normalizePrefix(prefix);
|
|
108
109
|
}
|
|
109
|
-
|
|
110
|
+
this.logger.debug(`finding files by filename: ${filename}, ref: ${ref}, prefix: ${prefix}`);
|
|
110
111
|
return await this.fileCache.findFilesByFilename(filename, ref, prefix);
|
|
111
112
|
});
|
|
112
113
|
this.createPullRequest = wrapAsync(async (pullRequest, targetBranch, message, updates, options) => {
|
|
@@ -122,7 +123,7 @@ class GitHub {
|
|
|
122
123
|
force: true,
|
|
123
124
|
fork: !!(options === null || options === void 0 ? void 0 : options.fork),
|
|
124
125
|
message,
|
|
125
|
-
logger:
|
|
126
|
+
logger: this.logger,
|
|
126
127
|
draft: !!(options === null || options === void 0 ? void 0 : options.draft),
|
|
127
128
|
labels: pullRequest.labels,
|
|
128
129
|
});
|
|
@@ -178,11 +179,11 @@ class GitHub {
|
|
|
178
179
|
force: true,
|
|
179
180
|
fork: (options === null || options === void 0 ? void 0 : options.fork) === false ? false : true,
|
|
180
181
|
message,
|
|
181
|
-
logger:
|
|
182
|
+
logger: this.logger,
|
|
182
183
|
draft: releasePullRequest.draft,
|
|
183
184
|
});
|
|
184
185
|
if (prNumber !== number) {
|
|
185
|
-
|
|
186
|
+
this.logger.warn(`updated code for ${prNumber}, but update requested for ${number}`);
|
|
186
187
|
}
|
|
187
188
|
const response = await this.octokit.pulls.update({
|
|
188
189
|
owner: this.repository.owner,
|
|
@@ -273,7 +274,7 @@ class GitHub {
|
|
|
273
274
|
* @throws {GitHubAPIError} on an API error
|
|
274
275
|
*/
|
|
275
276
|
this.commentOnIssue = wrapAsync(async (comment, number) => {
|
|
276
|
-
|
|
277
|
+
this.logger.debug(`adding comment to https://github.com/${this.repository.owner}/${this.repository.repo}/issue/${number}`);
|
|
277
278
|
const resp = await this.octokit.issues.createComment({
|
|
278
279
|
owner: this.repository.owner,
|
|
279
280
|
repo: this.repository.repo,
|
|
@@ -292,7 +293,7 @@ class GitHub {
|
|
|
292
293
|
if (labels.length === 0) {
|
|
293
294
|
return;
|
|
294
295
|
}
|
|
295
|
-
|
|
296
|
+
this.logger.debug(`removing labels: ${labels} from issue/pull ${number}`);
|
|
296
297
|
await Promise.all(labels.map(label => this.octokit.issues.removeLabel({
|
|
297
298
|
owner: this.repository.owner,
|
|
298
299
|
repo: this.repository.repo,
|
|
@@ -310,7 +311,7 @@ class GitHub {
|
|
|
310
311
|
if (labels.length === 0) {
|
|
311
312
|
return;
|
|
312
313
|
}
|
|
313
|
-
|
|
314
|
+
this.logger.debug(`adding labels: ${labels} from issue/pull ${number}`);
|
|
314
315
|
await this.octokit.issues.addLabels({
|
|
315
316
|
owner: this.repository.owner,
|
|
316
317
|
repo: this.repository.repo,
|
|
@@ -323,6 +324,7 @@ class GitHub {
|
|
|
323
324
|
this.request = options.octokitAPIs.request;
|
|
324
325
|
this.graphql = options.octokitAPIs.graphql;
|
|
325
326
|
this.fileCache = new git_file_utils_1.RepositoryFileCache(this.octokit, this.repository);
|
|
327
|
+
this.logger = (_a = options.logger) !== null && _a !== void 0 ? _a : logger_1.logger;
|
|
326
328
|
}
|
|
327
329
|
/**
|
|
328
330
|
* Build a new GitHub client with auto-detected default branch.
|
|
@@ -450,7 +452,7 @@ class GitHub {
|
|
|
450
452
|
}
|
|
451
453
|
async mergeCommitsGraphQL(targetBranch, cursor, options = {}) {
|
|
452
454
|
var _a, _b;
|
|
453
|
-
|
|
455
|
+
this.logger.debug(`Fetching merge commits on branch ${targetBranch} with cursor: ${cursor}`);
|
|
454
456
|
const query = `query pullRequestsSince($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $cursor: String) {
|
|
455
457
|
repository(owner: $owner, name: $repo) {
|
|
456
458
|
ref(qualifiedName: $targetBranch) {
|
|
@@ -510,12 +512,12 @@ class GitHub {
|
|
|
510
512
|
...params,
|
|
511
513
|
});
|
|
512
514
|
if (!response) {
|
|
513
|
-
|
|
515
|
+
this.logger.warn(`Did not receive a response for query: ${query}`, params);
|
|
514
516
|
return null;
|
|
515
517
|
}
|
|
516
518
|
// if the branch does exist, return null
|
|
517
519
|
if (!((_a = response.repository) === null || _a === void 0 ? void 0 : _a.ref)) {
|
|
518
|
-
|
|
520
|
+
this.logger.warn(`Could not find commits for branch ${targetBranch} - it likely does not exist.`);
|
|
519
521
|
return null;
|
|
520
522
|
}
|
|
521
523
|
const history = response.repository.ref.target.history;
|
|
@@ -542,7 +544,7 @@ class GitHub {
|
|
|
542
544
|
files,
|
|
543
545
|
};
|
|
544
546
|
if (((_b = pullRequest.files.pageInfo) === null || _b === void 0 ? void 0 : _b.hasNextPage) && options.backfillFiles) {
|
|
545
|
-
|
|
547
|
+
this.logger.info(`PR #${pullRequest.number} has many files, backfilling`);
|
|
546
548
|
commit.files = await this.getCommitFiles(graphCommit.sha);
|
|
547
549
|
}
|
|
548
550
|
else {
|
|
@@ -671,7 +673,7 @@ class GitHub {
|
|
|
671
673
|
*/
|
|
672
674
|
async pullRequestsGraphQL(targetBranch, states = 'MERGED', cursor) {
|
|
673
675
|
var _a;
|
|
674
|
-
|
|
676
|
+
this.logger.debug(`Fetching ${states} pull requests on branch ${targetBranch} with cursor ${cursor}`);
|
|
675
677
|
const response = await this.graphqlRequest({
|
|
676
678
|
query: `query mergedPullRequests($owner: String!, $repo: String!, $num: Int!, $maxFilesChanged: Int, $targetBranch: String!, $states: [PullRequestState!], $cursor: String) {
|
|
677
679
|
repository(owner: $owner, name: $repo) {
|
|
@@ -716,7 +718,7 @@ class GitHub {
|
|
|
716
718
|
maxFilesChanged: 64,
|
|
717
719
|
});
|
|
718
720
|
if (!((_a = response === null || response === void 0 ? void 0 : response.repository) === null || _a === void 0 ? void 0 : _a.pullRequests)) {
|
|
719
|
-
|
|
721
|
+
this.logger.warn(`Could not find merged pull requests for branch ${targetBranch} - it likely does not exist.`);
|
|
720
722
|
return null;
|
|
721
723
|
}
|
|
722
724
|
const pullRequests = (response.repository.pullRequests.nodes ||
|
|
@@ -770,7 +772,7 @@ class GitHub {
|
|
|
770
772
|
}
|
|
771
773
|
}
|
|
772
774
|
async releaseGraphQL(cursor) {
|
|
773
|
-
|
|
775
|
+
this.logger.debug(`Fetching releases with cursor ${cursor}`);
|
|
774
776
|
const response = await this.graphqlRequest({
|
|
775
777
|
query: `query releases($owner: String!, $repo: String!, $num: Int!, $cursor: String) {
|
|
776
778
|
repository(owner: $owner, name: $repo) {
|
|
@@ -800,7 +802,7 @@ class GitHub {
|
|
|
800
802
|
num: 25,
|
|
801
803
|
});
|
|
802
804
|
if (!response.repository.releases.nodes.length) {
|
|
803
|
-
|
|
805
|
+
this.logger.warn('Could not find releases.');
|
|
804
806
|
return null;
|
|
805
807
|
}
|
|
806
808
|
const releases = response.repository.releases.nodes;
|
|
@@ -810,7 +812,7 @@ class GitHub {
|
|
|
810
812
|
.filter(release => !!release.tagCommit)
|
|
811
813
|
.map(release => {
|
|
812
814
|
if (!release.tag || !release.tagCommit) {
|
|
813
|
-
|
|
815
|
+
this.logger.debug(release);
|
|
814
816
|
}
|
|
815
817
|
return {
|
|
816
818
|
name: release.name || undefined,
|
|
@@ -871,7 +873,7 @@ class GitHub {
|
|
|
871
873
|
* @throws {GitHubAPIError} on other API errors
|
|
872
874
|
*/
|
|
873
875
|
async getFileContentsOnBranch(path, branch) {
|
|
874
|
-
|
|
876
|
+
this.logger.debug(`Fetching ${path} from branch ${branch}`);
|
|
875
877
|
try {
|
|
876
878
|
return await this.fileCache.getFileContents(path, branch);
|
|
877
879
|
}
|
|
@@ -950,14 +952,14 @@ class GitHub {
|
|
|
950
952
|
// if the file is missing and create = false, just continue
|
|
951
953
|
// to the next update, otherwise create the file.
|
|
952
954
|
if (!update.createIfMissing) {
|
|
953
|
-
|
|
955
|
+
this.logger.warn(`file ${update.path} did not exist`);
|
|
954
956
|
continue;
|
|
955
957
|
}
|
|
956
958
|
}
|
|
957
959
|
const contentText = content
|
|
958
960
|
? Buffer.from(content.content, 'base64').toString('utf8')
|
|
959
961
|
: undefined;
|
|
960
|
-
const updatedContent = update.updater.updateContent(contentText);
|
|
962
|
+
const updatedContent = update.updater.updateContent(contentText, this.logger);
|
|
961
963
|
if (updatedContent) {
|
|
962
964
|
changes.set(update.path, {
|
|
963
965
|
content: updatedContent,
|
package/build/src/manifest.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ChangelogSection } from './changelog-notes';
|
|
|
2
2
|
import { GitHub, GitHubRelease } from './github';
|
|
3
3
|
import { Version } from './version';
|
|
4
4
|
import { PullRequest } from './pull-request';
|
|
5
|
+
import { Logger } from './util/logger';
|
|
5
6
|
import { ReleasePullRequest } from './release-pull-request';
|
|
6
7
|
import { ReleaseType, VersioningStrategyType, ChangelogNotesType } from './factory';
|
|
7
8
|
import { Release } from './release';
|
|
@@ -114,6 +115,7 @@ export interface ManifestOptions {
|
|
|
114
115
|
groupPullRequestTitlePattern?: string;
|
|
115
116
|
releaseSearchDepth?: number;
|
|
116
117
|
commitSearchDepth?: number;
|
|
118
|
+
logger?: Logger;
|
|
117
119
|
}
|
|
118
120
|
export interface ReleaserPackageConfig extends ReleaserConfigJson {
|
|
119
121
|
'package-name'?: string;
|
|
@@ -192,6 +194,7 @@ export declare class Manifest {
|
|
|
192
194
|
private groupPullRequestTitlePattern?;
|
|
193
195
|
readonly releaseSearchDepth: number;
|
|
194
196
|
readonly commitSearchDepth: number;
|
|
197
|
+
readonly logger: Logger;
|
|
195
198
|
/**
|
|
196
199
|
* Create a Manifest from explicit config in code. This assumes that the
|
|
197
200
|
* repository has a single component at the root path.
|