release-please 17.4.1 → 17.5.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/build/src/bin/release-please.js +39 -10
- package/build/src/bootstrapper.d.ts +2 -2
- package/build/src/changelog-notes/default.js +9 -1
- package/build/src/changelog-notes/github.d.ts +2 -2
- package/build/src/changelog-notes.d.ts +1 -0
- package/build/src/commit.d.ts +6 -0
- package/build/src/factories/changelog-notes-factory.d.ts +2 -2
- package/build/src/factories/plugin-factory.d.ts +2 -2
- package/build/src/factories/versioning-strategy-factory.d.ts +2 -2
- package/build/src/factory.d.ts +2 -2
- package/build/src/github-api.d.ts +260 -0
- package/build/src/github-api.js +701 -0
- package/build/src/github.d.ts +21 -171
- package/build/src/github.js +154 -699
- package/build/src/index.d.ts +2 -2
- package/build/src/index.js +1 -1
- package/build/src/local-github.d.ts +271 -0
- package/build/src/local-github.js +776 -0
- package/build/src/manifest.d.ts +7 -5
- package/build/src/manifest.js +28 -26
- package/build/src/plugin.d.ts +3 -3
- package/build/src/plugins/group-priority.d.ts +2 -2
- package/build/src/plugins/linked-versions.d.ts +2 -2
- package/build/src/plugins/maven-workspace.d.ts +2 -2
- package/build/src/plugins/merge.d.ts +2 -2
- package/build/src/plugins/node-workspace.d.ts +2 -2
- package/build/src/plugins/sentence-case.d.ts +2 -2
- package/build/src/plugins/workspace.d.ts +2 -2
- package/build/src/scm.d.ts +80 -0
- package/build/src/scm.js +16 -0
- package/build/src/strategies/base.d.ts +5 -3
- package/build/src/strategies/base.js +2 -0
- package/build/src/util/pull-request-overflow-handler.d.ts +2 -2
- package/package.json +2 -2
package/build/src/github.d.ts
CHANGED
|
@@ -2,18 +2,15 @@ import { PullRequest } from './pull-request';
|
|
|
2
2
|
import { Commit } from './commit';
|
|
3
3
|
import { Octokit } from '@octokit/rest';
|
|
4
4
|
import { request } from '@octokit/request';
|
|
5
|
-
export declare const GH_API_URL = "https://api.github.com";
|
|
6
|
-
export declare const GH_GRAPHQL_URL = "https://api.github.com";
|
|
7
5
|
type OctokitType = InstanceType<typeof Octokit>;
|
|
8
6
|
import { Repository } from './repository';
|
|
9
7
|
import { ReleasePullRequest } from './release-pull-request';
|
|
10
8
|
import { Update } from './update';
|
|
11
9
|
import { Release } from './release';
|
|
10
|
+
import { GitHubApi, GitHubCreateOptions } from './github-api';
|
|
12
11
|
import { GitHubFileContents } from '@google-automations/git-file-utils';
|
|
13
12
|
import { Logger } from 'code-suggester/build/src/types';
|
|
14
|
-
import {
|
|
15
|
-
import { HttpProxyAgent } from 'http-proxy-agent';
|
|
16
|
-
import { PullRequestOverflowHandler } from './util/pull-request-overflow-handler';
|
|
13
|
+
import { Scm, ScmChangeSet, ScmCommitIteratorOptions, ScmReleaseIteratorOptions, ScmTagIteratorOptions, ScmCreatePullRequestOptions, ScmReleaseOptions, ScmRelease, ScmTag, ScmUpdatePullRequestOptions } from './scm';
|
|
17
14
|
type RequestBuilderType = typeof request;
|
|
18
15
|
type DefaultFunctionType = RequestBuilderType['defaults'];
|
|
19
16
|
type RequestFunctionType = ReturnType<DefaultFunctionType>;
|
|
@@ -27,96 +24,25 @@ export interface GitHubOptions {
|
|
|
27
24
|
octokitAPIs: OctokitAPIs;
|
|
28
25
|
logger?: Logger;
|
|
29
26
|
}
|
|
30
|
-
interface ProxyOption {
|
|
31
|
-
host: string;
|
|
32
|
-
port: number;
|
|
33
|
-
}
|
|
34
|
-
interface GitHubCreateOptions {
|
|
35
|
-
owner: string;
|
|
36
|
-
repo: string;
|
|
37
|
-
defaultBranch?: string;
|
|
38
|
-
apiUrl?: string;
|
|
39
|
-
graphqlUrl?: string;
|
|
40
|
-
octokitAPIs?: OctokitAPIs;
|
|
41
|
-
token?: string;
|
|
42
|
-
logger?: Logger;
|
|
43
|
-
proxy?: ProxyOption;
|
|
44
|
-
fetch?: any;
|
|
45
|
-
}
|
|
46
27
|
type CommitFilter = (commit: Commit) => boolean;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
maxResults?: number;
|
|
57
|
-
}
|
|
58
|
-
export interface ReleaseOptions {
|
|
59
|
-
draft?: boolean;
|
|
60
|
-
prerelease?: boolean;
|
|
61
|
-
forceTag?: boolean;
|
|
62
|
-
}
|
|
63
|
-
export interface GitHubRelease {
|
|
64
|
-
id: number;
|
|
65
|
-
name?: string;
|
|
66
|
-
tagName: string;
|
|
67
|
-
sha: string;
|
|
68
|
-
notes?: string;
|
|
69
|
-
url: string;
|
|
70
|
-
draft?: boolean;
|
|
71
|
-
uploadUrl?: string;
|
|
72
|
-
}
|
|
73
|
-
export interface GitHubTag {
|
|
74
|
-
name: string;
|
|
75
|
-
sha: string;
|
|
76
|
-
}
|
|
77
|
-
interface FileDiff {
|
|
78
|
-
readonly mode: '100644' | '100755' | '040000' | '160000' | '120000';
|
|
79
|
-
readonly content: string | null;
|
|
80
|
-
readonly originalContent: string | null;
|
|
81
|
-
}
|
|
82
|
-
export type ChangeSet = Map<string, FileDiff>;
|
|
83
|
-
interface CreatePullRequestOptions {
|
|
84
|
-
fork?: boolean;
|
|
85
|
-
draft?: boolean;
|
|
86
|
-
}
|
|
87
|
-
export declare class GitHub {
|
|
28
|
+
type CommitIteratorOptions = ScmCommitIteratorOptions;
|
|
29
|
+
type ReleaseIteratorOptions = ScmReleaseIteratorOptions;
|
|
30
|
+
type TagIteratorOptions = ScmTagIteratorOptions;
|
|
31
|
+
export type ReleaseOptions = ScmReleaseOptions;
|
|
32
|
+
export type GitHubRelease = ScmRelease;
|
|
33
|
+
export type GitHubTag = ScmTag;
|
|
34
|
+
export type ChangeSet = ScmChangeSet;
|
|
35
|
+
type CreatePullRequestOptions = ScmCreatePullRequestOptions;
|
|
36
|
+
export declare class GitHub implements Scm {
|
|
88
37
|
readonly repository: Repository;
|
|
89
38
|
private octokit;
|
|
90
|
-
private request;
|
|
91
39
|
private graphql;
|
|
92
40
|
private fileCache;
|
|
93
41
|
private logger;
|
|
42
|
+
private gitHubApi;
|
|
94
43
|
private constructor();
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Build a new GitHub client with auto-detected default branch.
|
|
98
|
-
*
|
|
99
|
-
* @param {GitHubCreateOptions} options Configuration options
|
|
100
|
-
* @param {string} options.owner The repository owner.
|
|
101
|
-
* @param {string} options.repo The repository name.
|
|
102
|
-
* @param {string} options.defaultBranch Optional. The repository's default branch.
|
|
103
|
-
* Defaults to the value fetched via the API.
|
|
104
|
-
* @param {string} options.apiUrl Optional. The base url of the GitHub API.
|
|
105
|
-
* @param {string} options.graphqlUrl Optional. The base url of the GraphQL API.
|
|
106
|
-
* @param {OctokitAPISs} options.octokitAPIs Optional. Override the internal
|
|
107
|
-
* client instances with a pre-authenticated instance.
|
|
108
|
-
* @param {string} token Optional. A GitHub API token used for authentication.
|
|
109
|
-
*/
|
|
44
|
+
getGitHubApi(): GitHubApi;
|
|
110
45
|
static create(options: GitHubCreateOptions): Promise<GitHub>;
|
|
111
|
-
/**
|
|
112
|
-
* Returns the default branch for a given repository.
|
|
113
|
-
*
|
|
114
|
-
* @param {string} owner The GitHub repository owner
|
|
115
|
-
* @param {string} repo The GitHub repository name
|
|
116
|
-
* @param {OctokitType} octokit An authenticated octokit instance
|
|
117
|
-
* @returns {string} Name of the default branch
|
|
118
|
-
*/
|
|
119
|
-
static defaultBranch(owner: string, repo: string, octokit: OctokitType): Promise<string>;
|
|
120
46
|
/**
|
|
121
47
|
* Returns the list of commits to the default branch after the provided filter
|
|
122
48
|
* query has been satified.
|
|
@@ -169,36 +95,6 @@ export declare class GitHub {
|
|
|
169
95
|
* @throws {GitHubAPIError} on an API error
|
|
170
96
|
*/
|
|
171
97
|
pullRequestIterator(targetBranch: string, status?: 'OPEN' | 'CLOSED' | 'MERGED', maxResults?: number, includeFiles?: boolean): AsyncGenerator<PullRequest, void, void>;
|
|
172
|
-
/**
|
|
173
|
-
* Helper implementation of pullRequestIterator that includes files via
|
|
174
|
-
* the graphQL API.
|
|
175
|
-
*
|
|
176
|
-
* @param {string} targetBranch The base branch of the pull request
|
|
177
|
-
* @param {string} status The status of the pull request
|
|
178
|
-
* @param {number} maxResults Limit the number of results searched
|
|
179
|
-
*/
|
|
180
|
-
private pullRequestIteratorWithFiles;
|
|
181
|
-
/**
|
|
182
|
-
* Helper implementation of pullRequestIterator that excludes files
|
|
183
|
-
* via the REST API.
|
|
184
|
-
*
|
|
185
|
-
* @param {string} targetBranch The base branch of the pull request
|
|
186
|
-
* @param {string} status The status of the pull request
|
|
187
|
-
* @param {number} maxResults Limit the number of results searched
|
|
188
|
-
*/
|
|
189
|
-
private pullRequestIteratorWithoutFiles;
|
|
190
|
-
/**
|
|
191
|
-
* Return a list of merged pull requests. The list is not guaranteed to be sorted
|
|
192
|
-
* by merged_at, but is generally most recent first.
|
|
193
|
-
*
|
|
194
|
-
* @param {string} targetBranch - Base branch of the pull request. Defaults to
|
|
195
|
-
* the configured default branch.
|
|
196
|
-
* @param {number} page - Page of results. Defaults to 1.
|
|
197
|
-
* @param {number} perPage - Number of results per page. Defaults to 100.
|
|
198
|
-
* @returns {PullRequestHistory | null} - List of merged pull requests
|
|
199
|
-
* @throws {GitHubAPIError} on an API error
|
|
200
|
-
*/
|
|
201
|
-
private pullRequestsGraphQL;
|
|
202
98
|
/**
|
|
203
99
|
* Iterate through releases with a max number of results scanned.
|
|
204
100
|
*
|
|
@@ -208,8 +104,7 @@ export declare class GitHub {
|
|
|
208
104
|
* @yields {GitHubRelease}
|
|
209
105
|
* @throws {GitHubAPIError} on an API error
|
|
210
106
|
*/
|
|
211
|
-
releaseIterator(options?: ReleaseIteratorOptions): AsyncGenerator<
|
|
212
|
-
private releaseGraphQL;
|
|
107
|
+
releaseIterator(options?: ReleaseIteratorOptions): AsyncGenerator<ScmRelease, void, unknown>;
|
|
213
108
|
/**
|
|
214
109
|
* Iterate through tags with a max number of results scanned.
|
|
215
110
|
*
|
|
@@ -290,21 +185,6 @@ export declare class GitHub {
|
|
|
290
185
|
* @throws {GitHubAPIError} on an API error
|
|
291
186
|
*/
|
|
292
187
|
findFilesByGlobAndRef: (glob: string, ref: string, prefix?: string | undefined) => Promise<string[]>;
|
|
293
|
-
/**
|
|
294
|
-
* Open a pull request
|
|
295
|
-
*
|
|
296
|
-
* @deprecated This logic is handled by the Manifest class now as it
|
|
297
|
-
* can be more complicated if the release notes are too big
|
|
298
|
-
* @param {ReleasePullRequest} releasePullRequest Pull request data to update
|
|
299
|
-
* @param {string} targetBranch The base branch of the pull request
|
|
300
|
-
* @param {GitHubPR} options The pull request options
|
|
301
|
-
* @throws {GitHubAPIError} on an API error
|
|
302
|
-
*/
|
|
303
|
-
createReleasePullRequest(releasePullRequest: ReleasePullRequest, targetBranch: string, options?: {
|
|
304
|
-
signoffUser?: string;
|
|
305
|
-
fork?: boolean;
|
|
306
|
-
skipLabeling?: boolean;
|
|
307
|
-
}): Promise<PullRequest>;
|
|
308
188
|
/**
|
|
309
189
|
* Open a pull request
|
|
310
190
|
*
|
|
@@ -315,13 +195,13 @@ export declare class GitHub {
|
|
|
315
195
|
* @param {CreatePullRequestOptions} options The pull request options
|
|
316
196
|
* @throws {GitHubAPIError} on an API error
|
|
317
197
|
*/
|
|
318
|
-
createPullRequest
|
|
198
|
+
createPullRequest(pullRequest: PullRequest, targetBranch: string, message: string, updates: Update[], options?: CreatePullRequestOptions): Promise<PullRequest>;
|
|
319
199
|
/**
|
|
320
200
|
* Fetch a pull request given the pull number
|
|
321
201
|
* @param {number} number The pull request number
|
|
322
202
|
* @returns {PullRequest}
|
|
323
203
|
*/
|
|
324
|
-
getPullRequest
|
|
204
|
+
getPullRequest(number: number): Promise<PullRequest>;
|
|
325
205
|
/**
|
|
326
206
|
* Update a pull request's title and body.
|
|
327
207
|
* @param {number} number The pull request number
|
|
@@ -333,11 +213,7 @@ export declare class GitHub {
|
|
|
333
213
|
* @param {PullRequestOverflowHandler} options.pullRequestOverflowHandler Optional.
|
|
334
214
|
* Handles extra large pull request body messages.
|
|
335
215
|
*/
|
|
336
|
-
updatePullRequest
|
|
337
|
-
signoffUser?: string | undefined;
|
|
338
|
-
fork?: boolean | undefined;
|
|
339
|
-
pullRequestOverflowHandler?: PullRequestOverflowHandler | undefined;
|
|
340
|
-
} | undefined) => Promise<PullRequest>;
|
|
216
|
+
updatePullRequest(number: number, releasePullRequest: ReleasePullRequest, targetBranch: string, options?: ScmUpdatePullRequestOptions): Promise<PullRequest>;
|
|
341
217
|
/**
|
|
342
218
|
* Given a set of proposed updates, build a changeset to suggest.
|
|
343
219
|
*
|
|
@@ -384,7 +260,7 @@ export declare class GitHub {
|
|
|
384
260
|
* @throws {DuplicateReleaseError} if the release tag already exists
|
|
385
261
|
* @throws {GitHubAPIError} on other API errors
|
|
386
262
|
*/
|
|
387
|
-
createRelease
|
|
263
|
+
createRelease(release: Release, options?: ReleaseOptions): Promise<GitHubRelease>;
|
|
388
264
|
/**
|
|
389
265
|
* Makes a comment on a issue/pull request.
|
|
390
266
|
*
|
|
@@ -392,21 +268,21 @@ export declare class GitHub {
|
|
|
392
268
|
* @param {number} number - The issue or pull request number.
|
|
393
269
|
* @throws {GitHubAPIError} on an API error
|
|
394
270
|
*/
|
|
395
|
-
commentOnIssue
|
|
271
|
+
commentOnIssue(comment: string, number: number): Promise<string>;
|
|
396
272
|
/**
|
|
397
273
|
* Removes labels from an issue/pull request.
|
|
398
274
|
*
|
|
399
275
|
* @param {string[]} labels The labels to remove.
|
|
400
276
|
* @param {number} number The issue/pull request number.
|
|
401
277
|
*/
|
|
402
|
-
removeIssueLabels
|
|
278
|
+
removeIssueLabels(labels: string[], number: number): Promise<void>;
|
|
403
279
|
/**
|
|
404
280
|
* Adds label to an issue/pull request.
|
|
405
281
|
*
|
|
406
282
|
* @param {string[]} labels The labels to add.
|
|
407
283
|
* @param {number} number The issue/pull request number.
|
|
408
284
|
*/
|
|
409
|
-
addIssueLabels
|
|
285
|
+
addIssueLabels(labels: string[], number: number): Promise<void>;
|
|
410
286
|
/**
|
|
411
287
|
* Generate release notes from GitHub at tag
|
|
412
288
|
* @param {string} tagName Name of new release tag
|
|
@@ -425,32 +301,6 @@ export declare class GitHub {
|
|
|
425
301
|
* @returns {string} HTML URL of the new file
|
|
426
302
|
*/
|
|
427
303
|
createFileOnNewBranch(filename: string, contents: string, newBranchName: string, baseBranchName: string): Promise<string>;
|
|
428
|
-
/**
|
|
429
|
-
* Helper to fetch the SHA of a branch
|
|
430
|
-
* @param {string} branchName The name of the branch
|
|
431
|
-
* @return {string | undefined} Returns the SHA of the branch
|
|
432
|
-
* or undefined if it can't be found.
|
|
433
|
-
*/
|
|
434
|
-
private getBranchSha;
|
|
435
|
-
/**
|
|
436
|
-
* Helper to fork a branch from an existing branch. Uses `force` so
|
|
437
|
-
* it will overwrite the contents of `targetBranchName` to match
|
|
438
|
-
* the current contents of `baseBranchName`.
|
|
439
|
-
*
|
|
440
|
-
* @param {string} targetBranchName The name of the new forked branch
|
|
441
|
-
* @param {string} baseBranchName The base branch from which to fork.
|
|
442
|
-
* @returns {string} The branch SHA
|
|
443
|
-
* @throws {ConfigurationError} if the base branch cannot be found.
|
|
444
|
-
*/
|
|
445
|
-
private forkBranch;
|
|
446
|
-
/**
|
|
447
|
-
* Helper to create a new branch from a given SHA.
|
|
448
|
-
* @param {string} branchName The new branch name
|
|
449
|
-
* @param {string} branchSha The SHA of the branch
|
|
450
|
-
* @returns {string} The SHA of the new branch
|
|
451
|
-
*/
|
|
452
|
-
private createNewBranch;
|
|
453
|
-
private updateBranchSha;
|
|
454
304
|
}
|
|
455
305
|
export declare const sleepInMs: (ms: number) => Promise<unknown>;
|
|
456
306
|
export {};
|