release-please 17.7.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 (45) hide show
  1. package/build/src/factory.js +4 -0
  2. package/build/src/github-api.d.ts +1 -1
  3. package/build/src/github.d.ts +1 -1
  4. package/build/src/github.js +1 -1
  5. package/build/src/index.d.ts +1 -1
  6. package/build/src/index.js +1 -1
  7. package/build/src/local-github.d.ts +1 -1
  8. package/build/src/local-github.js +1 -1
  9. package/build/src/plugins/linked-versions.js +1 -1
  10. package/build/src/strategies/go-librarian.d.ts +9 -0
  11. package/build/src/strategies/go-librarian.js +70 -0
  12. package/build/src/strategies/java-yoshi-mono-repo.js +1 -1
  13. package/build/src/strategies/node-librarian.js +1 -1
  14. package/build/src/strategies/python-librarian.d.ts +6 -0
  15. package/build/src/strategies/python-librarian.js +35 -0
  16. package/build/src/updaters/go/version-go.js +1 -1
  17. package/build/src/updaters/{node/librarian-yaml.d.ts → librarian-yaml.d.ts} +16 -7
  18. package/build/src/updaters/librarian-yaml.js +120 -0
  19. package/build/src/util/code-suggester/default-options-handler.d.ts +10 -0
  20. package/build/src/util/code-suggester/default-options-handler.js +45 -0
  21. package/build/src/util/code-suggester/errors.d.ts +4 -0
  22. package/build/src/util/code-suggester/errors.js +24 -0
  23. package/build/src/util/code-suggester/github/branch.d.ts +45 -0
  24. package/build/src/util/code-suggester/github/branch.js +118 -0
  25. package/build/src/util/code-suggester/github/commit-and-push.d.ts +51 -0
  26. package/build/src/util/code-suggester/github/commit-and-push.js +141 -0
  27. package/build/src/util/code-suggester/github/create-commit.d.ts +20 -0
  28. package/build/src/util/code-suggester/github/create-commit.js +60 -0
  29. package/build/src/util/code-suggester/github/fork.d.ts +15 -0
  30. package/build/src/util/code-suggester/github/fork.js +48 -0
  31. package/build/src/util/code-suggester/github/labels.d.ts +14 -0
  32. package/build/src/util/code-suggester/github/labels.js +42 -0
  33. package/build/src/util/code-suggester/github/open-pull-request.d.ts +16 -0
  34. package/build/src/util/code-suggester/github/open-pull-request.js +56 -0
  35. package/build/src/util/code-suggester/index.d.ts +28 -0
  36. package/build/src/util/code-suggester/index.js +110 -0
  37. package/build/src/util/code-suggester/logger.d.ts +4 -0
  38. package/build/src/util/code-suggester/logger.js +37 -0
  39. package/build/src/util/code-suggester/types.d.ts +109 -0
  40. package/build/src/util/code-suggester/types.js +30 -0
  41. package/build/src/util/pull-request-title.js +4 -4
  42. package/package.json +3 -2
  43. package/build/src/updaters/java/librarian-yaml.d.ts +0 -29
  44. package/build/src/updaters/java/librarian-yaml.js +0 -81
  45. package/build/src/updaters/node/librarian-yaml.js +0 -73
@@ -38,6 +38,7 @@ const elixir_1 = require("./strategies/elixir");
38
38
  const expo_1 = require("./strategies/expo");
39
39
  const go_1 = require("./strategies/go");
40
40
  const go_yoshi_1 = require("./strategies/go-yoshi");
41
+ const go_librarian_1 = require("./strategies/go-librarian");
41
42
  const helm_1 = require("./strategies/helm");
42
43
  const java_1 = require("./strategies/java");
43
44
  const java_yoshi_1 = require("./strategies/java-yoshi");
@@ -50,6 +51,7 @@ const ocaml_1 = require("./strategies/ocaml");
50
51
  const php_1 = require("./strategies/php");
51
52
  const php_yoshi_1 = require("./strategies/php-yoshi");
52
53
  const python_1 = require("./strategies/python");
54
+ const python_librarian_1 = require("./strategies/python-librarian");
53
55
  const r_1 = require("./strategies/r");
54
56
  const ruby_1 = require("./strategies/ruby");
55
57
  const ruby_yoshi_1 = require("./strategies/ruby-yoshi");
@@ -67,6 +69,7 @@ const releasers = {
67
69
  'dotnet-yoshi': options => new dotnet_yoshi_1.DotnetYoshi(options),
68
70
  go: options => new go_1.Go(options),
69
71
  'go-yoshi': options => new go_yoshi_1.GoYoshi(options),
72
+ 'go-librarian': options => new go_librarian_1.GoLibrarian(options),
70
73
  java: options => new java_1.Java(options),
71
74
  maven: options => new maven_1.Maven(options),
72
75
  'java-yoshi': options => new java_yoshi_1.JavaYoshi(options),
@@ -94,6 +97,7 @@ const releasers = {
94
97
  php: options => new php_1.PHP(options),
95
98
  'php-yoshi': options => new php_yoshi_1.PHPYoshi(options),
96
99
  python: options => new python_1.Python(options),
100
+ 'python-librarian': options => new python_librarian_1.PythonLibrarian(options),
97
101
  r: options => new r_1.R(options),
98
102
  ruby: options => new ruby_1.Ruby(options),
99
103
  'ruby-yoshi': options => new ruby_yoshi_1.RubyYoshi(options),
@@ -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.7.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.7.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,9 @@
1
+ import { BaseStrategy, BuildUpdatesOptions, BaseStrategyOptions } from './base';
2
+ import { Update } from '../update';
3
+ import { Version } from '../version';
4
+ export declare class GoLibrarian extends BaseStrategy {
5
+ readonly versionFile: string;
6
+ constructor(options: BaseStrategyOptions);
7
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
8
+ protected initialReleaseVersion(): Version;
9
+ }
@@ -0,0 +1,70 @@
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
+ // http://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.GoLibrarian = void 0;
17
+ const base_1 = require("./base");
18
+ const changelog_1 = require("../updaters/changelog");
19
+ const librarian_yaml_1 = require("../updaters/librarian-yaml");
20
+ const version_1 = require("../version");
21
+ const version_go_1 = require("../updaters/go/version-go");
22
+ class GoLibrarian extends base_1.BaseStrategy {
23
+ constructor(options) {
24
+ var _a, _b;
25
+ options.changelogPath = (_a = options.changelogPath) !== null && _a !== void 0 ? _a : 'CHANGES.md';
26
+ super(options);
27
+ this.versionFile = (_b = options.versionFile) !== null && _b !== void 0 ? _b : 'internal/version.go';
28
+ }
29
+ async buildUpdates(options) {
30
+ const updates = [];
31
+ const version = options.newVersion;
32
+ if (!this.skipChangelog) {
33
+ updates.push({
34
+ path: this.addPath(this.changelogPath),
35
+ createIfMissing: true,
36
+ updater: new changelog_1.Changelog({
37
+ version,
38
+ changelogEntry: options.changelogEntry,
39
+ }),
40
+ });
41
+ }
42
+ if (this.versionFile) {
43
+ updates.push({
44
+ path: this.addPath(this.versionFile),
45
+ createIfMissing: false,
46
+ updater: new version_go_1.VersionGo({
47
+ version,
48
+ }),
49
+ });
50
+ }
51
+ updates.push({
52
+ path: 'librarian.yaml',
53
+ createIfMissing: false,
54
+ updater: new librarian_yaml_1.LibrarianYamlUpdater({
55
+ version,
56
+ packagePath: this.path,
57
+ component: this.component,
58
+ }),
59
+ });
60
+ return updates;
61
+ }
62
+ initialReleaseVersion() {
63
+ if (this.initialVersion) {
64
+ return version_1.Version.parse(this.initialVersion);
65
+ }
66
+ return version_1.Version.parse('1.0.0');
67
+ }
68
+ }
69
+ exports.GoLibrarian = GoLibrarian;
70
+ //# sourceMappingURL=go-librarian.js.map
@@ -23,7 +23,7 @@ const composite_1 = require("../updaters/composite");
23
23
  const errors_1 = require("../errors");
24
24
  const java_1 = require("./java");
25
25
  const java_update_1 = require("../updaters/java/java-update");
26
- const librarian_yaml_1 = require("../updaters/java/librarian-yaml");
26
+ const librarian_yaml_1 = require("../updaters/librarian-yaml");
27
27
  const filter_commits_1 = require("../util/filter-commits");
28
28
  class JavaYoshiMonoRepo extends java_1.Java {
29
29
  /**
@@ -20,7 +20,7 @@ const package_lock_json_1 = require("../updaters/node/package-lock-json");
20
20
  const samples_package_json_1 = require("../updaters/node/samples-package-json");
21
21
  const changelog_1 = require("../updaters/changelog");
22
22
  const package_json_1 = require("../updaters/node/package-json");
23
- const librarian_yaml_1 = require("../updaters/node/librarian-yaml");
23
+ const librarian_yaml_1 = require("../updaters/librarian-yaml");
24
24
  const errors_1 = require("../errors");
25
25
  const filter_commits_1 = require("../util/filter-commits");
26
26
  class NodeLibrarian extends base_1.BaseStrategy {
@@ -0,0 +1,6 @@
1
+ import { Python } from './python';
2
+ import { BuildUpdatesOptions } from './base';
3
+ import { Update } from '../update';
4
+ export declare class PythonLibrarian extends Python {
5
+ protected buildUpdates(options: BuildUpdatesOptions): Promise<Update[]>;
6
+ }
@@ -0,0 +1,35 @@
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
+ // http://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.PythonLibrarian = void 0;
17
+ const python_1 = require("./python");
18
+ const librarian_yaml_1 = require("../updaters/librarian-yaml");
19
+ class PythonLibrarian extends python_1.Python {
20
+ async buildUpdates(options) {
21
+ const updates = await super.buildUpdates(options);
22
+ // Update librarian.yaml if this package exists within it.
23
+ updates.push({
24
+ path: 'librarian.yaml',
25
+ createIfMissing: false,
26
+ updater: new librarian_yaml_1.LibrarianYamlUpdater({
27
+ version: options.newVersion,
28
+ packagePath: this.path,
29
+ }),
30
+ });
31
+ return updates;
32
+ }
33
+ }
34
+ exports.PythonLibrarian = PythonLibrarian;
35
+ //# sourceMappingURL=python-librarian.js.map
@@ -17,7 +17,7 @@ exports.VersionGo = void 0;
17
17
  const default_1 = require("../default");
18
18
  class VersionGo extends default_1.DefaultUpdater {
19
19
  updateContent(content) {
20
- return content.replace(/const Version = "[0-9]+\.[0-9]+\.[0-9](-\w+)?"/, `const Version = "${this.version.toString()}"`);
20
+ return content.replace(/const Version = "[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?"/, `const Version = "${this.version.toString()}"`);
21
21
  }
22
22
  }
23
23
  exports.VersionGo = VersionGo;
@@ -1,9 +1,14 @@
1
- import { DefaultUpdater, UpdateOptions } from '../default';
2
- import { Logger } from '../../util/logger';
1
+ import { DefaultUpdater, UpdateOptions } from './default';
2
+ import { Logger } from '../util/logger';
3
+ export interface JavaModule {
4
+ artifact_id: string;
5
+ [key: string]: any;
6
+ }
3
7
  export interface LibrarianLibrary {
4
8
  name: string;
5
- output: string;
6
9
  version: string;
10
+ output?: string;
11
+ java?: JavaModule;
7
12
  [key: string]: any;
8
13
  }
9
14
  export interface LibrarianYamlSchema {
@@ -11,19 +16,23 @@ export interface LibrarianYamlSchema {
11
16
  [key: string]: any;
12
17
  }
13
18
  export interface LibrarianUpdateOptions extends UpdateOptions {
14
- packagePath: string;
19
+ packagePath?: string;
20
+ component?: string;
15
21
  }
16
22
  /**
17
23
  * Updates a librarian.yaml file.
18
24
  */
19
25
  export declare class LibrarianYamlUpdater extends DefaultUpdater {
20
- private readonly packagePath;
26
+ private readonly packagePath?;
27
+ private readonly component?;
28
+ private readonly specialArtifacts;
21
29
  constructor(options: LibrarianUpdateOptions);
22
30
  /**
23
31
  * Given initial file contents, return updated contents.
24
32
  * @param {string} content The initial content
25
33
  * @returns {string} The updated content
26
34
  */
27
- updateContent(content: string, logger?: Logger): string;
28
- deriveOutputDirectory(library: LibrarianLibrary): string;
35
+ updateContent(content: string, _logger?: Logger): string;
36
+ private deriveOutputDirectory;
37
+ private findArtifactID;
29
38
  }
@@ -0,0 +1,120 @@
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
+ // http://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.LibrarianYamlUpdater = void 0;
17
+ const default_1 = require("./default");
18
+ const yaml = require("yaml");
19
+ const logger_1 = require("../util/logger");
20
+ /**
21
+ * Updates a librarian.yaml file.
22
+ */
23
+ class LibrarianYamlUpdater extends default_1.DefaultUpdater {
24
+ constructor(options) {
25
+ super(options);
26
+ this.specialArtifacts = new Map([
27
+ ['google-cloud-java', 'google-cloud-java'],
28
+ ]);
29
+ this.packagePath = options.packagePath;
30
+ this.component = options.component;
31
+ }
32
+ /**
33
+ * Given initial file contents, return updated contents.
34
+ * @param {string} content The initial content
35
+ * @returns {string} The updated content
36
+ */
37
+ updateContent(content, _logger = logger_1.logger) {
38
+ const doc = yaml.parseDocument(content);
39
+ if (!doc || doc.errors.length > 0) {
40
+ throw new Error(`Invalid yaml, cannot be parsed: ${doc.errors
41
+ .map(e => e.message)
42
+ .join(', ')}`);
43
+ }
44
+ const libraries = doc.get('libraries');
45
+ if (!libraries || !yaml.isSeq(libraries)) {
46
+ return content;
47
+ }
48
+ let modified = false;
49
+ for (const library of libraries.items) {
50
+ if (!yaml.isMap(library))
51
+ continue;
52
+ const libraryJSON = library.toJSON();
53
+ let newVersion = undefined;
54
+ if (this.versionsMap) {
55
+ // Multi-version (Java style)
56
+ const artifactID = this.findArtifactID(libraryJSON);
57
+ if (this.versionsMap.has(artifactID)) {
58
+ newVersion = this.versionsMap.get(artifactID);
59
+ }
60
+ }
61
+ else {
62
+ // Single version (Go, Python, Node style)
63
+ const isGoMatch = (this.packagePath && libraryJSON.name === this.packagePath) ||
64
+ (this.component && libraryJSON.name === this.component);
65
+ const isPythonNodeMatch = this.packagePath &&
66
+ this.deriveOutputDirectory(libraryJSON) === this.packagePath;
67
+ if (isGoMatch || isPythonNodeMatch) {
68
+ newVersion = this.version;
69
+ }
70
+ }
71
+ if (newVersion) {
72
+ const newVersionStr = newVersion.toString();
73
+ if (library.get('version') !== newVersionStr) {
74
+ library.set('version', newVersionStr);
75
+ modified = true;
76
+ }
77
+ if (this.versionsMap) {
78
+ const isSnapshot = newVersion.preRelease === 'SNAPSHOT';
79
+ if (!isSnapshot) {
80
+ let java = library.get('java');
81
+ if (!yaml.isMap(java)) {
82
+ const javaNode = doc.createNode({});
83
+ library.set('java', javaNode);
84
+ java = javaNode;
85
+ modified = true;
86
+ }
87
+ if (yaml.isMap(java)) {
88
+ if (java.get('released_version') !== newVersionStr) {
89
+ java.set('released_version', newVersionStr);
90
+ modified = true;
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ if (modified) {
98
+ return doc.toString({ lineWidth: 0 });
99
+ }
100
+ return content;
101
+ }
102
+ deriveOutputDirectory(library) {
103
+ if (library.output) {
104
+ return library.output;
105
+ }
106
+ return `packages/${library.name}`;
107
+ }
108
+ findArtifactID(library) {
109
+ const artifact = this.specialArtifacts.get(library.name);
110
+ if (artifact) {
111
+ return artifact;
112
+ }
113
+ if (library.java && library.java.artifact_id) {
114
+ return library.java.artifact_id;
115
+ }
116
+ return `google-cloud-${library.name}`;
117
+ }
118
+ }
119
+ exports.LibrarianYamlUpdater = LibrarianYamlUpdater;
120
+ //# sourceMappingURL=librarian-yaml.js.map
@@ -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>;