release-please 17.8.0 → 17.9.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.
Files changed (32) hide show
  1. package/build/src/github-api.d.ts +1 -1
  2. package/build/src/github.d.ts +1 -1
  3. package/build/src/github.js +1 -1
  4. package/build/src/index.d.ts +1 -1
  5. package/build/src/index.js +1 -1
  6. package/build/src/local-github.d.ts +1 -1
  7. package/build/src/local-github.js +1 -1
  8. package/build/src/plugins/linked-versions.js +1 -1
  9. package/build/src/util/code-suggester/default-options-handler.d.ts +10 -0
  10. package/build/src/util/code-suggester/default-options-handler.js +45 -0
  11. package/build/src/util/code-suggester/errors.d.ts +4 -0
  12. package/build/src/util/code-suggester/errors.js +24 -0
  13. package/build/src/util/code-suggester/github/branch.d.ts +45 -0
  14. package/build/src/util/code-suggester/github/branch.js +118 -0
  15. package/build/src/util/code-suggester/github/commit-and-push.d.ts +51 -0
  16. package/build/src/util/code-suggester/github/commit-and-push.js +141 -0
  17. package/build/src/util/code-suggester/github/create-commit.d.ts +20 -0
  18. package/build/src/util/code-suggester/github/create-commit.js +60 -0
  19. package/build/src/util/code-suggester/github/fork.d.ts +15 -0
  20. package/build/src/util/code-suggester/github/fork.js +48 -0
  21. package/build/src/util/code-suggester/github/labels.d.ts +14 -0
  22. package/build/src/util/code-suggester/github/labels.js +42 -0
  23. package/build/src/util/code-suggester/github/open-pull-request.d.ts +16 -0
  24. package/build/src/util/code-suggester/github/open-pull-request.js +56 -0
  25. package/build/src/util/code-suggester/index.d.ts +28 -0
  26. package/build/src/util/code-suggester/index.js +110 -0
  27. package/build/src/util/code-suggester/logger.d.ts +4 -0
  28. package/build/src/util/code-suggester/logger.js +37 -0
  29. package/build/src/util/code-suggester/types.d.ts +109 -0
  30. package/build/src/util/code-suggester/types.js +30 -0
  31. package/build/src/util/pull-request-title.js +4 -4
  32. package/package.json +3 -2
@@ -1,6 +1,6 @@
1
1
  import { Octokit } from '@octokit/rest';
2
2
  import { request } from '@octokit/request';
3
- import { Logger } from 'code-suggester/build/src/types';
3
+ import { Logger } from './util/code-suggester/types';
4
4
  import { PullRequest } from './pull-request';
5
5
  import { Repository } from './repository';
6
6
  import { Release } from './release';
@@ -9,7 +9,7 @@ import { Update } from './update';
9
9
  import { Release } from './release';
10
10
  import { GitHubApi, GitHubCreateOptions } from './github-api';
11
11
  import { GitHubFileContents } from '@google-automations/git-file-utils';
12
- import { Logger } from 'code-suggester/build/src/types';
12
+ import { Logger } from './util/code-suggester/types';
13
13
  import { Scm, ScmChangeSet, ScmCommitIteratorOptions, ScmReleaseIteratorOptions, ScmTagIteratorOptions, ScmCreatePullRequestOptions, ScmReleaseOptions, ScmRelease, ScmTag, ScmUpdatePullRequestOptions } from './scm';
14
14
  type RequestBuilderType = typeof request;
15
15
  type DefaultFunctionType = RequestBuilderType['defaults'];
@@ -15,7 +15,7 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.sleepInMs = exports.GitHub = void 0;
17
17
  const request_error_1 = require("@octokit/request-error");
18
- const code_suggester_1 = require("code-suggester");
18
+ const code_suggester_1 = require("./util/code-suggester");
19
19
  const errors_1 = require("./errors");
20
20
  const MAX_ISSUE_BODY_SIZE = 65536;
21
21
  const MAX_SLEEP_SECONDS = 20;
@@ -14,4 +14,4 @@ export { Logger, setLogger } from './util/logger';
14
14
  export { GitHub } from './github';
15
15
  export declare const configSchema: any;
16
16
  export declare const manifestSchema: any;
17
- export declare const VERSION = "17.8.0";
17
+ export declare const VERSION = "17.9.0";
@@ -36,6 +36,6 @@ Object.defineProperty(exports, "GitHub", { enumerable: true, get: function () {
36
36
  exports.configSchema = require('../../schemas/config.json');
37
37
  exports.manifestSchema = require('../../schemas/manifest.json');
38
38
  // x-release-please-start-version
39
- exports.VERSION = '17.8.0';
39
+ exports.VERSION = '17.9.0';
40
40
  // x-release-please-end
41
41
  //# sourceMappingURL=index.js.map
@@ -7,7 +7,7 @@ import { Update } from './update';
7
7
  import { Release } from './release';
8
8
  import { GitHubFileContents } from '@google-automations/git-file-utils';
9
9
  import { GitHubApi, GitHubCreateOptions } from './github-api';
10
- import { Logger } from 'code-suggester/build/src/types';
10
+ import { Logger } from './util/code-suggester/types';
11
11
  export interface LocalGitHubCreateOptions extends GitHubCreateOptions {
12
12
  cloneDepth?: number;
13
13
  localRepoPath?: string;
@@ -20,7 +20,7 @@ const os = require("os");
20
20
  const child_process = require("child_process");
21
21
  const util = require("util");
22
22
  const readline = require("readline");
23
- const code_suggester_1 = require("code-suggester");
23
+ const code_suggester_1 = require("./util/code-suggester");
24
24
  const execFile = util.promisify(child_process.execFile);
25
25
  const mkdtemp = fs.promises.mkdtemp;
26
26
  const errors_1 = require("./errors");
@@ -123,7 +123,7 @@ class LinkedVersions extends plugin_1.ManifestPlugin {
123
123
  // delegate to the merge plugin and add merged pull request
124
124
  if (inScopeCandidates.length > 0) {
125
125
  const merge = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig, {
126
- pullRequestTitlePattern: `chore\${scope}: release ${this.groupName} libraries`,
126
+ pullRequestTitlePattern: 'chore${scope}: release ' + this.groupName + ' libraries',
127
127
  forceMerge: true,
128
128
  headBranchName: branch_name_1.BranchName.ofGroupTargetBranch(this.groupName, this.targetBranch).toString(),
129
129
  });
@@ -0,0 +1,10 @@
1
+ import { CreatePullRequest, CreatePullRequestUserOptions } from './types';
2
+ /**
3
+ * Add defaults to GitHub Pull Request options.
4
+ * Preserves the empty string.
5
+ * For ESCMAScript, null/undefined values are preserved for required fields.
6
+ * Recommended with an object validation function to check empty strings and incorrect types.
7
+ * @param {PullRequestUserOptions} options the user-provided github pull request options
8
+ * @returns {CreatePullRequest} git hub context with defaults applied
9
+ */
10
+ export declare function addPullRequestDefaults(options: CreatePullRequestUserOptions): CreatePullRequest;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ // Copyright 2026 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.addPullRequestDefaults = void 0;
17
+ const DEFAULT_BRANCH_NAME = 'code-suggestions';
18
+ const DEFAULT_PRIMARY_BRANCH = 'main';
19
+ /**
20
+ * Add defaults to GitHub Pull Request options.
21
+ * Preserves the empty string.
22
+ * For ESCMAScript, null/undefined values are preserved for required fields.
23
+ * Recommended with an object validation function to check empty strings and incorrect types.
24
+ * @param {PullRequestUserOptions} options the user-provided github pull request options
25
+ * @returns {CreatePullRequest} git hub context with defaults applied
26
+ */
27
+ function addPullRequestDefaults(options) {
28
+ const pullRequestSettings = {
29
+ upstreamOwner: options.upstreamOwner,
30
+ upstreamRepo: options.upstreamRepo,
31
+ description: options.description,
32
+ title: options.title,
33
+ message: options.message,
34
+ force: options.force || false,
35
+ branch: typeof options.branch === 'string' ? options.branch : DEFAULT_BRANCH_NAME,
36
+ primary: typeof options.primary === 'string'
37
+ ? options.primary
38
+ : DEFAULT_PRIMARY_BRANCH,
39
+ maintainersCanModify: options.maintainersCanModify === false ? false : true,
40
+ filesPerCommit: options.filesPerCommit,
41
+ };
42
+ return pullRequestSettings;
43
+ }
44
+ exports.addPullRequestDefaults = addPullRequestDefaults;
45
+ //# sourceMappingURL=default-options-handler.js.map
@@ -0,0 +1,4 @@
1
+ export declare class CommitError extends Error {
2
+ cause: Error;
3
+ constructor(message: string, cause: Error);
4
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ // Copyright 2026 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.CommitError = void 0;
17
+ class CommitError extends Error {
18
+ constructor(message, cause) {
19
+ super(message);
20
+ this.cause = cause;
21
+ }
22
+ }
23
+ exports.CommitError = CommitError;
24
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1,45 @@
1
+ import { RepoDomain } from '../types';
2
+ import { Octokit } from '@octokit/rest';
3
+ /**
4
+ * Create a new branch reference with the ref prefix
5
+ * @param {string} branchName name of the branch
6
+ */
7
+ export declare function createRef(branchName: string): string;
8
+ /**
9
+ * get branch commit HEAD SHA of a repository
10
+ * Throws an error if the branch cannot be found
11
+ * @param {Octokit} octokit The authenticated octokit instance
12
+ * @param {RepoDomain} origin The domain information of the remote origin repository
13
+ * @param {string} branch the name of the branch
14
+ * @returns {Promise<string>} branch commit HEAD SHA
15
+ */
16
+ export declare function getBranchHead(octokit: Octokit, origin: RepoDomain, branch: string): Promise<string>;
17
+ /**
18
+ * Determine if there is a branch with the provided name in the remote GitHub repository
19
+ * @param {Octokit} octokit The authenticated octokit instance
20
+ * @param {RepoDomain} remote The domain information of the remote repository
21
+ * @param {string} name The branch name to create on the repository
22
+ * @returns {Promise<boolean>} if there is a branch already existing in the remote GitHub repository
23
+ */
24
+ export declare function existsBranchWithName(octokit: Octokit, remote: RepoDomain, name: string): Promise<boolean>;
25
+ /**
26
+ * Create a branch on the remote repository if there is not an existing branch
27
+ * @param {Octokit} octokit The authenticated octokit instance
28
+ * @param {RepoDomain} remote The domain information of the remote origin repository
29
+ * @param {string} name The branch name to create on the origin repository
30
+ * @param {string} baseSha the sha that the base of the reference points to
31
+ * @param {boolean} duplicate whether there is an existing branch or not
32
+ * @returns {Promise<void>}
33
+ */
34
+ export declare function createBranch(octokit: Octokit, remote: RepoDomain, name: string, baseSha: string, duplicate: boolean): Promise<void>;
35
+ /**
36
+ * Create a GitHub branch given a remote origin.
37
+ * Throws an exception if octokit fails, or if the base branch is invalid
38
+ * @param {Octokit} octokit The authenticated octokit instance
39
+ * @param {RepoDomain} origin The domain information of the remote origin repository
40
+ * @param {RepoDomain} upstream The domain information of the remote upstream repository
41
+ * @param {string} name The branch name to create on the origin repository
42
+ * @param {string} baseBranch the name of the branch to base the new branch off of. Default is main
43
+ * @returns {Promise<string>} the base SHA for subsequent commits to be based off for the origin branch
44
+ */
45
+ export declare function branch(octokit: Octokit, origin: RepoDomain, upstream: RepoDomain, name: string, baseBranch?: string): Promise<string>;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ // Copyright 2026 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.branch = exports.createBranch = exports.existsBranchWithName = exports.getBranchHead = exports.createRef = void 0;
17
+ const logger_1 = require("../logger");
18
+ const REF_PREFIX = 'refs/heads/';
19
+ const DEFAULT_PRIMARY_BRANCH = 'main';
20
+ /**
21
+ * Create a new branch reference with the ref prefix
22
+ * @param {string} branchName name of the branch
23
+ */
24
+ function createRef(branchName) {
25
+ return REF_PREFIX + branchName;
26
+ }
27
+ exports.createRef = createRef;
28
+ /**
29
+ * get branch commit HEAD SHA of a repository
30
+ * Throws an error if the branch cannot be found
31
+ * @param {Octokit} octokit The authenticated octokit instance
32
+ * @param {RepoDomain} origin The domain information of the remote origin repository
33
+ * @param {string} branch the name of the branch
34
+ * @returns {Promise<string>} branch commit HEAD SHA
35
+ */
36
+ async function getBranchHead(octokit, origin, branch) {
37
+ const branchData = (await octokit.repos.getBranch({
38
+ owner: origin.owner,
39
+ repo: origin.repo,
40
+ branch,
41
+ })).data;
42
+ logger_1.logger.info(`Successfully found branch HEAD sha "${branchData.commit.sha}".`);
43
+ return branchData.commit.sha;
44
+ }
45
+ exports.getBranchHead = getBranchHead;
46
+ /**
47
+ * Determine if there is a branch with the provided name in the remote GitHub repository
48
+ * @param {Octokit} octokit The authenticated octokit instance
49
+ * @param {RepoDomain} remote The domain information of the remote repository
50
+ * @param {string} name The branch name to create on the repository
51
+ * @returns {Promise<boolean>} if there is a branch already existing in the remote GitHub repository
52
+ */
53
+ async function existsBranchWithName(octokit, remote, name) {
54
+ try {
55
+ const data = (await octokit.git.getRef({
56
+ owner: remote.owner,
57
+ repo: remote.repo,
58
+ ref: `heads/${name}`,
59
+ })).data;
60
+ return data.ref ? true : false;
61
+ }
62
+ catch (err) {
63
+ if (err.status === 404)
64
+ return false;
65
+ else
66
+ throw err;
67
+ }
68
+ }
69
+ exports.existsBranchWithName = existsBranchWithName;
70
+ /**
71
+ * Create a branch on the remote repository if there is not an existing branch
72
+ * @param {Octokit} octokit The authenticated octokit instance
73
+ * @param {RepoDomain} remote The domain information of the remote origin repository
74
+ * @param {string} name The branch name to create on the origin repository
75
+ * @param {string} baseSha the sha that the base of the reference points to
76
+ * @param {boolean} duplicate whether there is an existing branch or not
77
+ * @returns {Promise<void>}
78
+ */
79
+ async function createBranch(octokit, remote, name, baseSha, duplicate) {
80
+ if (!duplicate) {
81
+ const refData = (await octokit.git.createRef({
82
+ owner: remote.owner,
83
+ repo: remote.repo,
84
+ ref: createRef(name),
85
+ sha: baseSha,
86
+ })).data;
87
+ logger_1.logger.info(`Successfully created branch at ${refData.url}`);
88
+ }
89
+ else {
90
+ logger_1.logger.info('Skipping branch creation step...');
91
+ }
92
+ }
93
+ exports.createBranch = createBranch;
94
+ /**
95
+ * Create a GitHub branch given a remote origin.
96
+ * Throws an exception if octokit fails, or if the base branch is invalid
97
+ * @param {Octokit} octokit The authenticated octokit instance
98
+ * @param {RepoDomain} origin The domain information of the remote origin repository
99
+ * @param {RepoDomain} upstream The domain information of the remote upstream repository
100
+ * @param {string} name The branch name to create on the origin repository
101
+ * @param {string} baseBranch the name of the branch to base the new branch off of. Default is main
102
+ * @returns {Promise<string>} the base SHA for subsequent commits to be based off for the origin branch
103
+ */
104
+ async function branch(octokit, origin, upstream, name, baseBranch = DEFAULT_PRIMARY_BRANCH) {
105
+ // create branch from primary branch HEAD SHA
106
+ try {
107
+ const baseSha = await getBranchHead(octokit, upstream, baseBranch);
108
+ const duplicate = await existsBranchWithName(octokit, origin, name);
109
+ await createBranch(octokit, origin, name, baseSha, duplicate);
110
+ return baseSha;
111
+ }
112
+ catch (err) {
113
+ logger_1.logger.error('Error when creating branch');
114
+ throw err;
115
+ }
116
+ }
117
+ exports.branch = branch;
118
+ //# sourceMappingURL=branch.js.map
@@ -0,0 +1,51 @@
1
+ import { Changes, TreeObject, RepoDomain, BranchDomain } from '../types';
2
+ import { Octokit } from '@octokit/rest';
3
+ import { CreateCommitOptions } from './create-commit';
4
+ /**
5
+ * Generate and return a GitHub tree object structure
6
+ * containing the target change data
7
+ * See https://developer.github.com/v3/git/trees/#tree-object
8
+ * @param {Changes} changes the set of repository changes
9
+ * @returns {TreeObject[]} The new GitHub changes
10
+ */
11
+ export declare function generateTreeObjects(changes: Changes): TreeObject[];
12
+ /**
13
+ * Upload and create a remote GitHub tree
14
+ * and resolves with the new tree SHA.
15
+ * Rejects if GitHub V3 API fails with the GitHub error response
16
+ * @param {Octokit} octokit The authenticated octokit instance
17
+ * @param {RepoDomain} origin the the remote repository to push changes to
18
+ * @param {string} refHead the base of the new commit(s)
19
+ * @param {TreeObject[]} tree the set of GitHub changes to upload
20
+ * @returns {Promise<string>} the GitHub tree SHA
21
+ * @throws {CommitError}
22
+ */
23
+ export declare function createTree(octokit: Octokit, origin: RepoDomain, refHead: string, tree: TreeObject[]): Promise<string>;
24
+ /**
25
+ * Update a reference to a SHA
26
+ * Rejects if GitHub V3 API fails with the GitHub error response
27
+ * @param {Octokit} octokit The authenticated octokit instance
28
+ * @param {BranchDomain} origin the the remote branch to push changes to
29
+ * @param {string} newSha the ref to update the commit HEAD to
30
+ * @param {boolean} force to force the commit changes given refHead
31
+ * @returns {Promise<void>}
32
+ */
33
+ export declare function updateRef(octokit: Octokit, origin: BranchDomain, newSha: string, force: boolean): Promise<void>;
34
+ interface CommitAndPushOptions extends CreateCommitOptions {
35
+ filesPerCommit?: number;
36
+ }
37
+ /**
38
+ * Given a set of changes, apply the commit(s) on top of the given branch's head and upload it to GitHub
39
+ * Rejects if GitHub V3 API fails with the GitHub error response
40
+ * @param {Octokit} octokit The authenticated octokit instance
41
+ * @param {string} refHead the base of the new commit(s)
42
+ * @param {Changes} changes the set of repository changes
43
+ * @param {RepoDomain} origin the the remote repository to push changes to
44
+ * @param {string} originBranchName the remote branch that will contain the new changes
45
+ * @param {string} commitMessage the message of the new commit
46
+ * @param {boolean} force to force the commit changes given refHead
47
+ * @returns {Promise<void>}
48
+ * @throws {CommitError}
49
+ */
50
+ export declare function commitAndPush(octokit: Octokit, refHead: string, changes: Changes, originBranch: BranchDomain, commitMessage: string, force: boolean, options?: CommitAndPushOptions): Promise<void>;
51
+ export {};
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ // Copyright 2026 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.commitAndPush = exports.updateRef = exports.createTree = exports.generateTreeObjects = void 0;
17
+ const logger_1 = require("../logger");
18
+ const create_commit_1 = require("./create-commit");
19
+ const errors_1 = require("../errors");
20
+ const DEFAULT_FILES_PER_COMMIT = 100;
21
+ /**
22
+ * Generate and return a GitHub tree object structure
23
+ * containing the target change data
24
+ * See https://developer.github.com/v3/git/trees/#tree-object
25
+ * @param {Changes} changes the set of repository changes
26
+ * @returns {TreeObject[]} The new GitHub changes
27
+ */
28
+ function generateTreeObjects(changes) {
29
+ const tree = [];
30
+ changes.forEach((fileData, path) => {
31
+ if (fileData.content === null) {
32
+ // if no file content then file is deleted
33
+ tree.push({
34
+ path,
35
+ mode: fileData.mode,
36
+ type: 'blob',
37
+ sha: null,
38
+ });
39
+ }
40
+ else {
41
+ // update file with its content
42
+ tree.push({
43
+ path,
44
+ mode: fileData.mode,
45
+ type: 'blob',
46
+ content: fileData.content,
47
+ });
48
+ }
49
+ });
50
+ return tree;
51
+ }
52
+ exports.generateTreeObjects = generateTreeObjects;
53
+ function* inGroupsOf(all, groupSize) {
54
+ for (let i = 0; i < all.length; i += groupSize) {
55
+ yield all.slice(i, i + groupSize);
56
+ }
57
+ }
58
+ /**
59
+ * Upload and create a remote GitHub tree
60
+ * and resolves with the new tree SHA.
61
+ * Rejects if GitHub V3 API fails with the GitHub error response
62
+ * @param {Octokit} octokit The authenticated octokit instance
63
+ * @param {RepoDomain} origin the the remote repository to push changes to
64
+ * @param {string} refHead the base of the new commit(s)
65
+ * @param {TreeObject[]} tree the set of GitHub changes to upload
66
+ * @returns {Promise<string>} the GitHub tree SHA
67
+ * @throws {CommitError}
68
+ */
69
+ async function createTree(octokit, origin, refHead, tree) {
70
+ const oldTreeSha = (await octokit.git.getCommit({
71
+ owner: origin.owner,
72
+ repo: origin.repo,
73
+ commit_sha: refHead,
74
+ })).data.tree.sha;
75
+ logger_1.logger.info('Got the latest commit tree');
76
+ try {
77
+ const treeSha = (await octokit.git.createTree({
78
+ owner: origin.owner,
79
+ repo: origin.repo,
80
+ tree,
81
+ base_tree: oldTreeSha,
82
+ })).data.sha;
83
+ logger_1.logger.info(`Successfully created a tree with the desired changes with SHA ${treeSha}`);
84
+ return treeSha;
85
+ }
86
+ catch (e) {
87
+ throw new errors_1.CommitError(`Error adding to tree: ${refHead}`, e);
88
+ }
89
+ }
90
+ exports.createTree = createTree;
91
+ /**
92
+ * Update a reference to a SHA
93
+ * Rejects if GitHub V3 API fails with the GitHub error response
94
+ * @param {Octokit} octokit The authenticated octokit instance
95
+ * @param {BranchDomain} origin the the remote branch to push changes to
96
+ * @param {string} newSha the ref to update the commit HEAD to
97
+ * @param {boolean} force to force the commit changes given refHead
98
+ * @returns {Promise<void>}
99
+ */
100
+ async function updateRef(octokit, origin, newSha, force) {
101
+ logger_1.logger.info(`Updating reference heads/${origin.branch} to ${newSha}`);
102
+ try {
103
+ await octokit.git.updateRef({
104
+ owner: origin.owner,
105
+ repo: origin.repo,
106
+ ref: `heads/${origin.branch}`,
107
+ sha: newSha,
108
+ force,
109
+ });
110
+ logger_1.logger.info(`Successfully updated reference ${origin.branch} to ${newSha}`);
111
+ }
112
+ catch (e) {
113
+ throw new errors_1.CommitError(`Error updating ref heads/${origin.branch} to ${newSha}`, e);
114
+ }
115
+ }
116
+ exports.updateRef = updateRef;
117
+ /**
118
+ * Given a set of changes, apply the commit(s) on top of the given branch's head and upload it to GitHub
119
+ * Rejects if GitHub V3 API fails with the GitHub error response
120
+ * @param {Octokit} octokit The authenticated octokit instance
121
+ * @param {string} refHead the base of the new commit(s)
122
+ * @param {Changes} changes the set of repository changes
123
+ * @param {RepoDomain} origin the the remote repository to push changes to
124
+ * @param {string} originBranchName the remote branch that will contain the new changes
125
+ * @param {string} commitMessage the message of the new commit
126
+ * @param {boolean} force to force the commit changes given refHead
127
+ * @returns {Promise<void>}
128
+ * @throws {CommitError}
129
+ */
130
+ async function commitAndPush(octokit, refHead, changes, originBranch, commitMessage, force, options) {
131
+ var _a;
132
+ const filesPerCommit = (_a = options === null || options === void 0 ? void 0 : options.filesPerCommit) !== null && _a !== void 0 ? _a : DEFAULT_FILES_PER_COMMIT;
133
+ const tree = generateTreeObjects(changes);
134
+ for (const treeGroup of inGroupsOf(tree, filesPerCommit)) {
135
+ const treeSha = await createTree(octokit, originBranch, refHead, treeGroup);
136
+ refHead = await (0, create_commit_1.createCommit)(octokit, originBranch, refHead, treeSha, commitMessage, options);
137
+ }
138
+ await updateRef(octokit, originBranch, refHead, force);
139
+ }
140
+ exports.commitAndPush = commitAndPush;
141
+ //# sourceMappingURL=commit-and-push.js.map
@@ -0,0 +1,20 @@
1
+ import { Octokit } from '@octokit/rest';
2
+ import { RepoDomain, CommitSigner, UserData } from '../types';
3
+ export interface CreateCommitOptions {
4
+ signer?: CommitSigner;
5
+ author?: UserData;
6
+ committer?: UserData;
7
+ }
8
+ /**
9
+ * Create a commit with a repo snapshot SHA on top of the reference HEAD
10
+ * and resolves with the SHA of the commit.
11
+ * Rejects if GitHub V3 API fails with the GitHub error response
12
+ * @param {Octokit} octokit The authenticated octokit instance
13
+ * @param {RepoDomain} origin the the remote repository to push changes to
14
+ * @param {string} refHead the base of the new commit(s)
15
+ * @param {string} treeSha the tree SHA that this commit will point to
16
+ * @param {string} message the message of the new commit
17
+ * @returns {Promise<string>} the new commit SHA
18
+ * @see https://docs.github.com/en/rest/git/commits?apiVersion=2022-11-28#create-a-commit
19
+ */
20
+ export declare function createCommit(octokit: Octokit, origin: RepoDomain, refHead: string, treeSha: string, message: string, options?: CreateCommitOptions): Promise<string>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ // Copyright 2026 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.createCommit = void 0;
17
+ const logger_1 = require("../logger");
18
+ const errors_1 = require("../errors");
19
+ /**
20
+ * Create a commit with a repo snapshot SHA on top of the reference HEAD
21
+ * and resolves with the SHA of the commit.
22
+ * Rejects if GitHub V3 API fails with the GitHub error response
23
+ * @param {Octokit} octokit The authenticated octokit instance
24
+ * @param {RepoDomain} origin the the remote repository to push changes to
25
+ * @param {string} refHead the base of the new commit(s)
26
+ * @param {string} treeSha the tree SHA that this commit will point to
27
+ * @param {string} message the message of the new commit
28
+ * @returns {Promise<string>} the new commit SHA
29
+ * @see https://docs.github.com/en/rest/git/commits?apiVersion=2022-11-28#create-a-commit
30
+ */
31
+ async function createCommit(octokit, origin, refHead, treeSha, message, options = {}) {
32
+ try {
33
+ const signature = options.signer
34
+ ? await options.signer.generateSignature({
35
+ message,
36
+ tree: treeSha,
37
+ parents: [refHead],
38
+ author: options.author,
39
+ committer: options.committer,
40
+ })
41
+ : undefined;
42
+ const { data: { sha, url }, } = await octokit.git.createCommit({
43
+ owner: origin.owner,
44
+ repo: origin.repo,
45
+ message,
46
+ tree: treeSha,
47
+ parents: [refHead],
48
+ signature,
49
+ author: options.author,
50
+ committer: options.committer,
51
+ });
52
+ logger_1.logger.info(`Successfully created commit. See commit at ${url}`);
53
+ return sha;
54
+ }
55
+ catch (e) {
56
+ throw new errors_1.CommitError(`Error creating commit for: ${treeSha}`, e);
57
+ }
58
+ }
59
+ exports.createCommit = createCommit;
60
+ //# sourceMappingURL=create-commit.js.map
@@ -0,0 +1,15 @@
1
+ import { RepoDomain } from '../types';
2
+ import { Octokit } from '@octokit/rest';
3
+ /**
4
+ * Fork the GitHub owner's repository.
5
+ * Returns the fork owner and fork repo when the fork creation request to GitHub succeeds.
6
+ * Otherwise throws error.
7
+ *
8
+ * If fork already exists no new fork is created, no error occurs, and the existing Fork data is returned
9
+ * with the `updated_at` + any historical repo changes.
10
+ * @param {Octokit} octokit The authenticated octokit instance
11
+ * @param {RepoDomain} upstream upstream repository information
12
+ * @returns {Promise<RepoDomain>} the forked repository name, as well as the owner of that fork
13
+ */
14
+ declare function fork(octokit: Octokit, upstream: RepoDomain): Promise<RepoDomain>;
15
+ export { fork };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ // Copyright 2026 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.fork = void 0;
17
+ const logger_1 = require("../logger");
18
+ /**
19
+ * Fork the GitHub owner's repository.
20
+ * Returns the fork owner and fork repo when the fork creation request to GitHub succeeds.
21
+ * Otherwise throws error.
22
+ *
23
+ * If fork already exists no new fork is created, no error occurs, and the existing Fork data is returned
24
+ * with the `updated_at` + any historical repo changes.
25
+ * @param {Octokit} octokit The authenticated octokit instance
26
+ * @param {RepoDomain} upstream upstream repository information
27
+ * @returns {Promise<RepoDomain>} the forked repository name, as well as the owner of that fork
28
+ */
29
+ async function fork(octokit, upstream) {
30
+ try {
31
+ const forkedRepo = (await octokit.repos.createFork({
32
+ owner: upstream.owner,
33
+ repo: upstream.repo,
34
+ })).data;
35
+ const origin = {
36
+ repo: forkedRepo.name,
37
+ owner: forkedRepo.owner.login,
38
+ };
39
+ logger_1.logger.info(`Create fork request was successful for ${origin.owner}/${origin.repo}`);
40
+ return origin;
41
+ }
42
+ catch (err) {
43
+ logger_1.logger.error('Error when forking');
44
+ throw err;
45
+ }
46
+ }
47
+ exports.fork = fork;
48
+ //# sourceMappingURL=fork.js.map
@@ -0,0 +1,14 @@
1
+ import { BranchDomain, RepoDomain } from '../types';
2
+ import { Octokit } from '@octokit/rest';
3
+ /**
4
+ * Create a GitHub PR on the upstream organization's repo
5
+ * Throws an error if the GitHub API fails
6
+ * @param {Octokit} octokit The authenticated octokit instance
7
+ * @param {RepoDomain} upstream The upstream repository
8
+ * @param {BranchDomain} origin The remote origin information that contains the origin branch
9
+ * @param {number} issue_number The issue number to add labels to. Can also be a PR number
10
+ * @param {string[]} labels The list of labels to apply to the newly created PR. Default is []. the funciton will no-op.
11
+ * @returns {Promise<string[]>} The list of resulting labels after the addition of the given labels
12
+ */
13
+ declare function addLabels(octokit: Octokit, upstream: RepoDomain, origin: BranchDomain, issue_number: number, labels?: string[]): Promise<string[]>;
14
+ export { addLabels };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // Copyright 2026 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.addLabels = void 0;
17
+ const logger_1 = require("../logger");
18
+ /**
19
+ * Create a GitHub PR on the upstream organization's repo
20
+ * Throws an error if the GitHub API fails
21
+ * @param {Octokit} octokit The authenticated octokit instance
22
+ * @param {RepoDomain} upstream The upstream repository
23
+ * @param {BranchDomain} origin The remote origin information that contains the origin branch
24
+ * @param {number} issue_number The issue number to add labels to. Can also be a PR number
25
+ * @param {string[]} labels The list of labels to apply to the newly created PR. Default is []. the funciton will no-op.
26
+ * @returns {Promise<string[]>} The list of resulting labels after the addition of the given labels
27
+ */
28
+ async function addLabels(octokit, upstream, origin, issue_number, labels) {
29
+ if (!labels || labels.length === 0) {
30
+ return [];
31
+ }
32
+ const labelsResponseData = (await octokit.issues.addLabels({
33
+ owner: upstream.owner,
34
+ repo: origin.repo,
35
+ issue_number: issue_number,
36
+ labels: labels,
37
+ })).data;
38
+ logger_1.logger.info(`Successfully added labels ${labels} to issue: ${issue_number}`);
39
+ return labelsResponseData.map(l => l.name);
40
+ }
41
+ exports.addLabels = addLabels;
42
+ //# sourceMappingURL=labels.js.map
@@ -0,0 +1,16 @@
1
+ import { BranchDomain, Description, RepoDomain } from '../types';
2
+ import { Octokit } from '@octokit/rest';
3
+ /**
4
+ * Create a GitHub PR on the upstream organization's repo
5
+ * Throws an error if the GitHub API fails
6
+ * @param {Octokit} octokit The authenticated octokit instance
7
+ * @param {RepoDomain} upstream The upstream repository
8
+ * @param {BranchDomain} origin The remote origin information that contains the origin branch
9
+ * @param {Description} description The pull request title and detailed description
10
+ * @param {boolean} maintainersCanModify Whether or not maintainers can modify the pull request. Default is true
11
+ * @param {string} upstreamPrimary The upstream repository's primary branch. Default is main.
12
+ * @param draft Open a DRAFT pull request. Defaults to false.
13
+ * @returns {Promise<void>}
14
+ */
15
+ declare function openPullRequest(octokit: Octokit, upstream: RepoDomain, origin: BranchDomain, description: Description, maintainersCanModify?: boolean, upstreamPrimary?: string, draft?: boolean): Promise<number>;
16
+ export { openPullRequest };
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ // Copyright 2026 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.openPullRequest = void 0;
17
+ const logger_1 = require("../logger");
18
+ const DEFAULT_PRIMARY = 'main';
19
+ /**
20
+ * Create a GitHub PR on the upstream organization's repo
21
+ * Throws an error if the GitHub API fails
22
+ * @param {Octokit} octokit The authenticated octokit instance
23
+ * @param {RepoDomain} upstream The upstream repository
24
+ * @param {BranchDomain} origin The remote origin information that contains the origin branch
25
+ * @param {Description} description The pull request title and detailed description
26
+ * @param {boolean} maintainersCanModify Whether or not maintainers can modify the pull request. Default is true
27
+ * @param {string} upstreamPrimary The upstream repository's primary branch. Default is main.
28
+ * @param draft Open a DRAFT pull request. Defaults to false.
29
+ * @returns {Promise<void>}
30
+ */
31
+ async function openPullRequest(octokit, upstream, origin, description, maintainersCanModify = true, upstreamPrimary = DEFAULT_PRIMARY, draft = false) {
32
+ const head = `${origin.owner}:${origin.branch}`;
33
+ const existingPullRequest = (await octokit.pulls.list({
34
+ owner: upstream.owner,
35
+ repo: origin.repo,
36
+ head,
37
+ })).data.find(pr => pr.head.label === head);
38
+ if (existingPullRequest) {
39
+ logger_1.logger.info(`Found existing pull request for reference ${origin.owner}:${origin.branch}. Skipping creating a new pull request.`);
40
+ return existingPullRequest.number;
41
+ }
42
+ const pullResponseData = (await octokit.pulls.create({
43
+ owner: upstream.owner,
44
+ repo: origin.repo,
45
+ title: description.title,
46
+ head: `${origin.owner}:${origin.branch}`,
47
+ base: upstreamPrimary,
48
+ body: description.body,
49
+ maintainer_can_modify: maintainersCanModify,
50
+ draft: draft,
51
+ })).data;
52
+ logger_1.logger.info(`Successfully opened pull request available at url: ${pullResponseData.url}.`);
53
+ return pullResponseData.number;
54
+ }
55
+ exports.openPullRequest = openPullRequest;
56
+ //# sourceMappingURL=open-pull-request.js.map
@@ -0,0 +1,28 @@
1
+ import { Changes, CreatePullRequestUserOptions } from './types';
2
+ import { Octokit } from '@octokit/rest';
3
+ /**
4
+ * Make a new GitHub Pull Request with a set of changes applied on top of primary branch HEAD.
5
+ * The changes are committed into a new branch based on the upstream repository options using the authenticated Octokit account.
6
+ * Then a Pull Request is made from that branch.
7
+ *
8
+ * Also throws error if git data from the fork is not ready in 5 minutes.
9
+ *
10
+ * From the docs
11
+ * https://developer.github.com/v3/repos/forks/#create-a-fork
12
+ * """
13
+ * Forking a Repository happens asynchronously.
14
+ * You may have to wait a short period of time before you can access the git objects.
15
+ * If this takes longer than 5 minutes, be sure to contact GitHub Support or GitHub Premium Support.
16
+ * """
17
+ *
18
+ * If changes are empty then the workflow will not run.
19
+ * Rethrows an HttpError if Octokit GitHub API returns an error. HttpError Octokit access_token and client_secret headers redact all sensitive information.
20
+ * @param {Octokit} octokit The authenticated octokit instance, instantiated with an access token having permissiong to create a fork on the target repository
21
+ * @param {Changes | null | undefined} changes A set of changes. The changes may be empty
22
+ * @param {CreatePullRequestUserOptions} options The configuration for interacting with GitHub provided by the user.
23
+ * @returns {Promise<number>} the pull request number. Returns 0 if unsuccessful.
24
+ * @throws {CommitError} on failure during commit process
25
+ */
26
+ declare function createPullRequest(octokit: Octokit, changes: Changes | null | undefined, options: CreatePullRequestUserOptions): Promise<number>;
27
+ export { Changes, CommitData, CommitSigner } from './types';
28
+ export { createPullRequest };
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ // Copyright 2026 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.createPullRequest = void 0;
17
+ const logger_1 = require("./logger");
18
+ const default_options_handler_1 = require("./default-options-handler");
19
+ const retry = require("async-retry");
20
+ const branch_1 = require("./github/branch");
21
+ const fork_1 = require("./github/fork");
22
+ const commit_and_push_1 = require("./github/commit-and-push");
23
+ const open_pull_request_1 = require("./github/open-pull-request");
24
+ const labels_1 = require("./github/labels");
25
+ /**
26
+ * Make a new GitHub Pull Request with a set of changes applied on top of primary branch HEAD.
27
+ * The changes are committed into a new branch based on the upstream repository options using the authenticated Octokit account.
28
+ * Then a Pull Request is made from that branch.
29
+ *
30
+ * Also throws error if git data from the fork is not ready in 5 minutes.
31
+ *
32
+ * From the docs
33
+ * https://developer.github.com/v3/repos/forks/#create-a-fork
34
+ * """
35
+ * Forking a Repository happens asynchronously.
36
+ * You may have to wait a short period of time before you can access the git objects.
37
+ * If this takes longer than 5 minutes, be sure to contact GitHub Support or GitHub Premium Support.
38
+ * """
39
+ *
40
+ * If changes are empty then the workflow will not run.
41
+ * Rethrows an HttpError if Octokit GitHub API returns an error. HttpError Octokit access_token and client_secret headers redact all sensitive information.
42
+ * @param {Octokit} octokit The authenticated octokit instance, instantiated with an access token having permissiong to create a fork on the target repository
43
+ * @param {Changes | null | undefined} changes A set of changes. The changes may be empty
44
+ * @param {CreatePullRequestUserOptions} options The configuration for interacting with GitHub provided by the user.
45
+ * @returns {Promise<number>} the pull request number. Returns 0 if unsuccessful.
46
+ * @throws {CommitError} on failure during commit process
47
+ */
48
+ async function createPullRequest(octokit, changes, options) {
49
+ (0, logger_1.setupLogger)(options.logger);
50
+ // if null undefined, or the empty map then no changes have been provided.
51
+ // Do not execute GitHub workflow
52
+ if (changes === null || changes === undefined || changes.size === 0) {
53
+ logger_1.logger.info('Empty change set provided. No changes need to be made. Cancelling workflow.');
54
+ return 0;
55
+ }
56
+ const gitHubConfigs = (0, default_options_handler_1.addPullRequestDefaults)(options);
57
+ logger_1.logger.info('Starting GitHub PR workflow...');
58
+ const upstream = {
59
+ owner: gitHubConfigs.upstreamOwner,
60
+ repo: gitHubConfigs.upstreamRepo,
61
+ };
62
+ const origin = options.fork === false ? upstream : await (0, fork_1.fork)(octokit, upstream);
63
+ if (options.fork) {
64
+ // try to sync the fork
65
+ await retry(async () => await octokit.repos.mergeUpstream({
66
+ owner: origin.owner,
67
+ repo: origin.repo,
68
+ branch: gitHubConfigs.primary,
69
+ }), {
70
+ retries: options.retry,
71
+ factor: 2.8411,
72
+ minTimeout: 3000,
73
+ randomize: false,
74
+ onRetry: (e, attempt) => {
75
+ e.message = `Error creating syncing upstream: ${e.message}`;
76
+ logger_1.logger.error(e);
77
+ logger_1.logger.info(`Retry attempt #${attempt}...`);
78
+ },
79
+ });
80
+ }
81
+ const originBranch = {
82
+ ...origin,
83
+ branch: gitHubConfigs.branch,
84
+ };
85
+ // The `retry` flag defaults to `5` to maintain compatibility
86
+ options.retry = options.retry === undefined ? 5 : options.retry;
87
+ const refHeadSha = await retry(async () => await (0, branch_1.branch)(octokit, origin, upstream, originBranch.branch, gitHubConfigs.primary), {
88
+ retries: options.retry,
89
+ factor: 2.8411,
90
+ minTimeout: 3000,
91
+ randomize: false,
92
+ onRetry: (e, attempt) => {
93
+ e.message = `Error creating Pull Request: ${e.message}`;
94
+ logger_1.logger.error(e);
95
+ logger_1.logger.info(`Retry attempt #${attempt}...`);
96
+ },
97
+ });
98
+ await (0, commit_and_push_1.commitAndPush)(octokit, refHeadSha, changes, originBranch, gitHubConfigs.message, gitHubConfigs.force, options);
99
+ const description = {
100
+ body: gitHubConfigs.description,
101
+ title: gitHubConfigs.title,
102
+ };
103
+ const prNumber = await (0, open_pull_request_1.openPullRequest)(octokit, upstream, originBranch, description, gitHubConfigs.maintainersCanModify, gitHubConfigs.primary, options.draft);
104
+ logger_1.logger.info(`Successfully opened pull request: ${prNumber}.`);
105
+ // addLabels will no-op if options.labels is undefined or empty.
106
+ await (0, labels_1.addLabels)(octokit, upstream, originBranch, prNumber, options.labels);
107
+ return prNumber;
108
+ }
109
+ exports.createPullRequest = createPullRequest;
110
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,4 @@
1
+ import { Logger } from './types';
2
+ declare let logger: Logger;
3
+ declare function setupLogger(userLogger?: Logger): void;
4
+ export { logger, setupLogger };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ // Copyright 2026 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.setupLogger = exports.logger = void 0;
17
+ class NullLogger {
18
+ constructor() {
19
+ this.error = () => { };
20
+ this.warn = () => { };
21
+ this.info = () => { };
22
+ this.debug = () => { };
23
+ this.trace = () => { };
24
+ }
25
+ }
26
+ let logger = new NullLogger();
27
+ exports.logger = logger;
28
+ function setupLogger(userLogger) {
29
+ if (userLogger) {
30
+ exports.logger = logger = userLogger;
31
+ }
32
+ else {
33
+ exports.logger = logger = new NullLogger();
34
+ }
35
+ }
36
+ exports.setupLogger = setupLogger;
37
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1,109 @@
1
+ import { CreateCommitOptions } from './github/create-commit';
2
+ export type FileMode = '100644' | '100755' | '040000' | '160000' | '120000';
3
+ /**
4
+ * GitHub definition of tree
5
+ */
6
+ export interface TreeObject {
7
+ path: string;
8
+ mode: FileMode;
9
+ type: 'blob' | 'tree' | 'commit';
10
+ sha?: string | null;
11
+ content?: string;
12
+ }
13
+ /**
14
+ * The content and the mode of a file.
15
+ * Default file mode is a text file which has code '100644'.
16
+ * If `content` is not null, then `content` must be the entire file content.
17
+ * See https://developer.github.com/v3/git/trees/#tree-object for details on mode.
18
+ */
19
+ export declare class FileData {
20
+ readonly mode: FileMode;
21
+ readonly content: string | null;
22
+ constructor(content: string | null, mode?: FileMode);
23
+ }
24
+ /**
25
+ * The map of a path to its content data.
26
+ * The content must be the entire file content.
27
+ */
28
+ export type Changes = Map<string, FileData>;
29
+ /**
30
+ * The domain of a repository
31
+ */
32
+ export interface RepoDomain {
33
+ repo: string;
34
+ owner: string;
35
+ }
36
+ /**
37
+ * The domain for a branch
38
+ */
39
+ export interface BranchDomain extends RepoDomain {
40
+ branch: string;
41
+ }
42
+ /**
43
+ * The descriptive properties for any entity
44
+ */
45
+ export interface Description {
46
+ title: string;
47
+ body: string;
48
+ }
49
+ /**
50
+ * The user options for creating GitHub PRs
51
+ */
52
+ export interface CreatePullRequestUserOptions extends CreateCommitOptions {
53
+ upstreamOwner: string;
54
+ upstreamRepo: string;
55
+ message: string;
56
+ description: string;
57
+ title: string;
58
+ branch?: string;
59
+ force?: boolean;
60
+ fork?: boolean;
61
+ primary?: string;
62
+ maintainersCanModify?: boolean;
63
+ labels?: string[];
64
+ retry?: number;
65
+ draft?: boolean;
66
+ logger?: Logger;
67
+ filesPerCommit?: number;
68
+ }
69
+ /**
70
+ * GitHub data needed for creating a PR
71
+ */
72
+ export interface CreatePullRequest {
73
+ upstreamOwner: string;
74
+ upstreamRepo: string;
75
+ message: string;
76
+ description: string;
77
+ title: string;
78
+ branch: string;
79
+ force: boolean;
80
+ primary: string;
81
+ maintainersCanModify: boolean;
82
+ filesPerCommit?: number;
83
+ }
84
+ interface LogFn {
85
+ <T extends object>(obj: T, msg?: string, ...args: any[]): void;
86
+ (msg: string, ...args: any[]): void;
87
+ }
88
+ export interface Logger {
89
+ error: LogFn;
90
+ warn: LogFn;
91
+ info: LogFn;
92
+ debug: LogFn;
93
+ trace: LogFn;
94
+ }
95
+ export interface UserData {
96
+ name: string;
97
+ email: string;
98
+ }
99
+ export interface CommitData {
100
+ message: string;
101
+ tree: string;
102
+ parents: string[];
103
+ author?: UserData;
104
+ committer?: UserData;
105
+ }
106
+ export interface CommitSigner {
107
+ generateSignature(commit: CommitData): Promise<string>;
108
+ }
109
+ export {};
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ // Copyright 2026 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.FileData = void 0;
17
+ /**
18
+ * The content and the mode of a file.
19
+ * Default file mode is a text file which has code '100644'.
20
+ * If `content` is not null, then `content` must be the entire file content.
21
+ * See https://developer.github.com/v3/git/trees/#tree-object for details on mode.
22
+ */
23
+ class FileData {
24
+ constructor(content, mode = '100644') {
25
+ this.mode = mode;
26
+ this.content = content;
27
+ }
28
+ }
29
+ exports.FileData = FileData;
30
+ //# sourceMappingURL=types.js.map
@@ -32,10 +32,10 @@ function generateMatchPattern(pullRequestTitlePattern, componentNoSpace, logger
32
32
  pullRequestTitlePattern.search(/\$\{version\}/) === -1)
33
33
  logger.warn("pullRequestTitlePattern miss the part of '${version}'");
34
34
  return new RegExp(`^${(pullRequestTitlePattern || DEFAULT_PR_TITLE_PATTERN)
35
- .replace('[', '\\[') // TODO: handle all regex escaping
36
- .replace(']', '\\]')
37
- .replace('(', '\\(')
38
- .replace(')', '\\)')
35
+ .replace(/\[/g, '\\[') // TODO: handle all regex escaping
36
+ .replace(/\]/g, '\\]')
37
+ .replace(/\(/g, '\\(')
38
+ .replace(/\)/g, '\\)')
39
39
  .replace('${scope}', '(\\((?<branch>[\\w-./]+)\\))?')
40
40
  .replace('${component}', componentNoSpace === true
41
41
  ? '?(?<component>@?[\\w-./]*)?'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-please",
3
- "version": "17.8.0",
3
+ "version": "17.9.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",
@@ -39,6 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@octokit/types": "^9.0.0",
42
+ "@types/async-retry": "^1.4.9",
42
43
  "@types/chai": "^4.1.7",
43
44
  "@types/diff": "^5.0.2",
44
45
  "@types/iarna__toml": "^2.0.1",
@@ -75,8 +76,8 @@
75
76
  "@octokit/rest": "^20.1.1",
76
77
  "@types/npm-package-arg": "^6.1.0",
77
78
  "@xmldom/xmldom": "^0.8.4",
79
+ "async-retry": "^1.3.3",
78
80
  "chalk": "^4.0.0",
79
- "code-suggester": "^5.0.0",
80
81
  "conventional-changelog-conventionalcommits": "^6.0.0",
81
82
  "conventional-changelog-writer": "^6.0.0",
82
83
  "conventional-commits-filter": "^3.0.0",