@release-please-oss/release-please 0.0.0 → 17.11.3

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 (310) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +280 -0
  3. package/build/src/bin/release-please.d.ts +22 -0
  4. package/build/src/bin/release-please.js +727 -0
  5. package/build/src/bootstrapper.d.ts +18 -0
  6. package/build/src/bootstrapper.js +64 -0
  7. package/build/src/changelog-notes/default.d.ts +15 -0
  8. package/build/src/changelog-notes/default.js +96 -0
  9. package/build/src/changelog-notes/github.d.ts +8 -0
  10. package/build/src/changelog-notes/github.js +29 -0
  11. package/build/src/changelog-notes.d.ts +22 -0
  12. package/build/src/changelog-notes.js +40 -0
  13. package/build/src/commit.d.ts +33 -0
  14. package/build/src/commit.js +422 -0
  15. package/build/src/errors/index.d.ts +36 -0
  16. package/build/src/errors/index.js +77 -0
  17. package/build/src/factories/changelog-notes-factory.d.ts +16 -0
  18. package/build/src/factories/changelog-notes-factory.js +44 -0
  19. package/build/src/factories/plugin-factory.d.ts +23 -0
  20. package/build/src/factories/plugin-factory.js +94 -0
  21. package/build/src/factories/versioning-strategy-factory.d.ts +16 -0
  22. package/build/src/factories/versioning-strategy-factory.js +52 -0
  23. package/build/src/factory.d.ts +18 -0
  24. package/build/src/factory.js +161 -0
  25. package/build/src/github-api.d.ts +260 -0
  26. package/build/src/github-api.js +714 -0
  27. package/build/src/github.d.ts +306 -0
  28. package/build/src/github.js +769 -0
  29. package/build/src/index.d.ts +17 -0
  30. package/build/src/index.js +41 -0
  31. package/build/src/local-github.d.ts +270 -0
  32. package/build/src/local-github.js +756 -0
  33. package/build/src/manifest.d.ts +370 -0
  34. package/build/src/manifest.js +1142 -0
  35. package/build/src/plugin.d.ts +37 -0
  36. package/build/src/plugin.js +57 -0
  37. package/build/src/plugins/cargo-workspace.d.ts +58 -0
  38. package/build/src/plugins/cargo-workspace.js +339 -0
  39. package/build/src/plugins/group-priority.d.ts +29 -0
  40. package/build/src/plugins/group-priority.js +82 -0
  41. package/build/src/plugins/linked-versions.d.ts +36 -0
  42. package/build/src/plugins/linked-versions.js +137 -0
  43. package/build/src/plugins/maven-workspace.d.ts +81 -0
  44. package/build/src/plugins/maven-workspace.js +431 -0
  45. package/build/src/plugins/merge.d.ts +27 -0
  46. package/build/src/plugins/merge.js +99 -0
  47. package/build/src/plugins/node-workspace.d.ts +50 -0
  48. package/build/src/plugins/node-workspace.js +352 -0
  49. package/build/src/plugins/sentence-case.d.ts +19 -0
  50. package/build/src/plugins/sentence-case.js +80 -0
  51. package/build/src/plugins/workspace.d.ts +173 -0
  52. package/build/src/plugins/workspace.js +308 -0
  53. package/build/src/pull-request.d.ts +11 -0
  54. package/build/src/pull-request.js +16 -0
  55. package/build/src/release-pull-request.d.ts +14 -0
  56. package/build/src/release-pull-request.js +16 -0
  57. package/build/src/release.d.ts +7 -0
  58. package/build/src/release.js +16 -0
  59. package/build/src/repository.d.ts +5 -0
  60. package/build/src/repository.js +16 -0
  61. package/build/src/scm.d.ts +80 -0
  62. package/build/src/scm.js +16 -0
  63. package/build/src/strategies/base.d.ts +162 -0
  64. package/build/src/strategies/base.js +494 -0
  65. package/build/src/strategies/bazel.d.ts +7 -0
  66. package/build/src/strategies/bazel.js +49 -0
  67. package/build/src/strategies/dart.d.ts +8 -0
  68. package/build/src/strategies/dart.js +73 -0
  69. package/build/src/strategies/dotnet-yoshi.d.ts +13 -0
  70. package/build/src/strategies/dotnet-yoshi.js +109 -0
  71. package/build/src/strategies/elixir.d.ts +5 -0
  72. package/build/src/strategies/elixir.js +46 -0
  73. package/build/src/strategies/expo.d.ts +15 -0
  74. package/build/src/strategies/expo.js +51 -0
  75. package/build/src/strategies/go-librarian.d.ts +11 -0
  76. package/build/src/strategies/go-librarian.js +84 -0
  77. package/build/src/strategies/go-yoshi.d.ts +14 -0
  78. package/build/src/strategies/go-yoshi.js +168 -0
  79. package/build/src/strategies/go.d.ts +7 -0
  80. package/build/src/strategies/go.js +53 -0
  81. package/build/src/strategies/helm.d.ts +8 -0
  82. package/build/src/strategies/helm.js +73 -0
  83. package/build/src/strategies/java-yoshi-mono-repo.d.ts +22 -0
  84. package/build/src/strategies/java-yoshi-mono-repo.js +308 -0
  85. package/build/src/strategies/java-yoshi.d.ts +20 -0
  86. package/build/src/strategies/java-yoshi.js +210 -0
  87. package/build/src/strategies/java.d.ts +28 -0
  88. package/build/src/strategies/java.js +176 -0
  89. package/build/src/strategies/krm-blueprint.d.ts +7 -0
  90. package/build/src/strategies/krm-blueprint.js +65 -0
  91. package/build/src/strategies/maven.d.ts +9 -0
  92. package/build/src/strategies/maven.js +56 -0
  93. package/build/src/strategies/node-librarian.d.ts +10 -0
  94. package/build/src/strategies/node-librarian.js +121 -0
  95. package/build/src/strategies/node.d.ts +10 -0
  96. package/build/src/strategies/node.js +111 -0
  97. package/build/src/strategies/ocaml.d.ts +5 -0
  98. package/build/src/strategies/ocaml.js +86 -0
  99. package/build/src/strategies/php-librarian.d.ts +6 -0
  100. package/build/src/strategies/php-librarian.js +35 -0
  101. package/build/src/strategies/php-yoshi.d.ts +13 -0
  102. package/build/src/strategies/php-yoshi.js +255 -0
  103. package/build/src/strategies/php.d.ts +6 -0
  104. package/build/src/strategies/php.js +76 -0
  105. package/build/src/strategies/python-librarian.d.ts +6 -0
  106. package/build/src/strategies/python-librarian.js +35 -0
  107. package/build/src/strategies/python.d.ts +11 -0
  108. package/build/src/strategies/python.js +175 -0
  109. package/build/src/strategies/r.d.ts +8 -0
  110. package/build/src/strategies/r.js +67 -0
  111. package/build/src/strategies/ruby-librarian.d.ts +6 -0
  112. package/build/src/strategies/ruby-librarian.js +35 -0
  113. package/build/src/strategies/ruby-yoshi.d.ts +13 -0
  114. package/build/src/strategies/ruby-yoshi.js +97 -0
  115. package/build/src/strategies/ruby.d.ts +9 -0
  116. package/build/src/strategies/ruby.js +71 -0
  117. package/build/src/strategies/rust.d.ts +17 -0
  118. package/build/src/strategies/rust.js +149 -0
  119. package/build/src/strategies/sfdx.d.ts +9 -0
  120. package/build/src/strategies/sfdx.js +67 -0
  121. package/build/src/strategies/simple.d.ts +7 -0
  122. package/build/src/strategies/simple.js +51 -0
  123. package/build/src/strategies/terraform-module.d.ts +7 -0
  124. package/build/src/strategies/terraform-module.js +90 -0
  125. package/build/src/strategy.d.ts +68 -0
  126. package/build/src/strategy.js +16 -0
  127. package/build/src/update.d.ts +24 -0
  128. package/build/src/update.js +16 -0
  129. package/build/src/updaters/base-xml.d.ts +19 -0
  130. package/build/src/updaters/base-xml.js +43 -0
  131. package/build/src/updaters/bazel/module-bazel.d.ts +7 -0
  132. package/build/src/updaters/bazel/module-bazel.js +33 -0
  133. package/build/src/updaters/changelog-json.d.ts +29 -0
  134. package/build/src/updaters/changelog-json.js +100 -0
  135. package/build/src/updaters/changelog.d.ts +13 -0
  136. package/build/src/updaters/changelog.js +55 -0
  137. package/build/src/updaters/composite.d.ts +20 -0
  138. package/build/src/updaters/composite.js +65 -0
  139. package/build/src/updaters/dart/pubspec-yaml.d.ts +13 -0
  140. package/build/src/updaters/dart/pubspec-yaml.js +50 -0
  141. package/build/src/updaters/default.d.ts +21 -0
  142. package/build/src/updaters/default.js +36 -0
  143. package/build/src/updaters/dotnet/apis.d.ts +18 -0
  144. package/build/src/updaters/dotnet/apis.js +45 -0
  145. package/build/src/updaters/dotnet/csproj.d.ts +12 -0
  146. package/build/src/updaters/dotnet/csproj.js +33 -0
  147. package/build/src/updaters/elixir/elixir-mix-exs.d.ts +13 -0
  148. package/build/src/updaters/elixir/elixir-mix-exs.js +42 -0
  149. package/build/src/updaters/expo/app-json.d.ts +31 -0
  150. package/build/src/updaters/expo/app-json.js +67 -0
  151. package/build/src/updaters/generic-json.d.ts +14 -0
  152. package/build/src/updaters/generic-json.js +54 -0
  153. package/build/src/updaters/generic-toml.d.ts +21 -0
  154. package/build/src/updaters/generic-toml.js +66 -0
  155. package/build/src/updaters/generic-xml.d.ts +8 -0
  156. package/build/src/updaters/generic-xml.js +38 -0
  157. package/build/src/updaters/generic-yaml.d.ts +23 -0
  158. package/build/src/updaters/generic-yaml.js +85 -0
  159. package/build/src/updaters/generic.d.ts +54 -0
  160. package/build/src/updaters/generic.js +187 -0
  161. package/build/src/updaters/go/version-go.d.ts +4 -0
  162. package/build/src/updaters/go/version-go.js +24 -0
  163. package/build/src/updaters/helm/chart-yaml.d.ts +13 -0
  164. package/build/src/updaters/helm/chart-yaml.js +41 -0
  165. package/build/src/updaters/java/java-released.d.ts +28 -0
  166. package/build/src/updaters/java/java-released.js +59 -0
  167. package/build/src/updaters/java/java-update.d.ts +21 -0
  168. package/build/src/updaters/java/java-update.js +80 -0
  169. package/build/src/updaters/java/pom-xml.d.ts +29 -0
  170. package/build/src/updaters/java/pom-xml.js +135 -0
  171. package/build/src/updaters/java/versions-manifest.d.ts +19 -0
  172. package/build/src/updaters/java/versions-manifest.js +71 -0
  173. package/build/src/updaters/krm/krm-blueprint-version.d.ts +13 -0
  174. package/build/src/updaters/krm/krm-blueprint-version.js +46 -0
  175. package/build/src/updaters/librarian-yaml.d.ts +45 -0
  176. package/build/src/updaters/librarian-yaml.js +149 -0
  177. package/build/src/updaters/node/package-json.d.ts +46 -0
  178. package/build/src/updaters/node/package-json.js +106 -0
  179. package/build/src/updaters/node/package-lock-json.d.ts +14 -0
  180. package/build/src/updaters/node/package-lock-json.js +83 -0
  181. package/build/src/updaters/node/samples-package-json.d.ts +24 -0
  182. package/build/src/updaters/node/samples-package-json.js +49 -0
  183. package/build/src/updaters/ocaml/dune-project.d.ts +13 -0
  184. package/build/src/updaters/ocaml/dune-project.js +37 -0
  185. package/build/src/updaters/ocaml/esy-json.d.ts +13 -0
  186. package/build/src/updaters/ocaml/esy-json.js +37 -0
  187. package/build/src/updaters/ocaml/opam.d.ts +13 -0
  188. package/build/src/updaters/ocaml/opam.js +37 -0
  189. package/build/src/updaters/php/php-client-version.d.ts +12 -0
  190. package/build/src/updaters/php/php-client-version.js +32 -0
  191. package/build/src/updaters/php/root-composer-update-packages.d.ts +13 -0
  192. package/build/src/updaters/php/root-composer-update-packages.js +60 -0
  193. package/build/src/updaters/python/pyproject-toml.d.ts +29 -0
  194. package/build/src/updaters/python/pyproject-toml.js +53 -0
  195. package/build/src/updaters/python/python-file-with-version.d.ts +12 -0
  196. package/build/src/updaters/python/python-file-with-version.js +32 -0
  197. package/build/src/updaters/python/setup-cfg.d.ts +12 -0
  198. package/build/src/updaters/python/setup-cfg.js +32 -0
  199. package/build/src/updaters/python/setup-py.d.ts +12 -0
  200. package/build/src/updaters/python/setup-py.js +32 -0
  201. package/build/src/updaters/r/description.d.ts +12 -0
  202. package/build/src/updaters/r/description.js +32 -0
  203. package/build/src/updaters/r/news.d.ts +12 -0
  204. package/build/src/updaters/r/news.js +49 -0
  205. package/build/src/updaters/raw-content.d.ts +19 -0
  206. package/build/src/updaters/raw-content.js +39 -0
  207. package/build/src/updaters/release-please-config.d.ts +8 -0
  208. package/build/src/updaters/release-please-config.js +80 -0
  209. package/build/src/updaters/release-please-manifest.d.ts +4 -0
  210. package/build/src/updaters/release-please-manifest.js +34 -0
  211. package/build/src/updaters/ruby/common.d.ts +17 -0
  212. package/build/src/updaters/ruby/common.js +46 -0
  213. package/build/src/updaters/ruby/gemfile-lock.d.ts +24 -0
  214. package/build/src/updaters/ruby/gemfile-lock.js +53 -0
  215. package/build/src/updaters/ruby/version-rb.d.ts +12 -0
  216. package/build/src/updaters/ruby/version-rb.js +34 -0
  217. package/build/src/updaters/rust/cargo-lock.d.ts +16 -0
  218. package/build/src/updaters/rust/cargo-lock.js +64 -0
  219. package/build/src/updaters/rust/cargo-toml.d.ts +13 -0
  220. package/build/src/updaters/rust/cargo-toml.js +89 -0
  221. package/build/src/updaters/rust/common.d.ts +54 -0
  222. package/build/src/updaters/rust/common.js +35 -0
  223. package/build/src/updaters/sfdx/sfdx-project-json.d.ts +21 -0
  224. package/build/src/updaters/sfdx/sfdx-project-json.js +41 -0
  225. package/build/src/updaters/terraform/metadata-version.d.ts +13 -0
  226. package/build/src/updaters/terraform/metadata-version.js +37 -0
  227. package/build/src/updaters/terraform/module-version.d.ts +13 -0
  228. package/build/src/updaters/terraform/module-version.js +37 -0
  229. package/build/src/updaters/terraform/readme.d.ts +12 -0
  230. package/build/src/updaters/terraform/readme.js +32 -0
  231. package/build/src/util/branch-name.d.ts +20 -0
  232. package/build/src/util/branch-name.js +225 -0
  233. package/build/src/util/code-suggester/default-options-handler.d.ts +10 -0
  234. package/build/src/util/code-suggester/default-options-handler.js +45 -0
  235. package/build/src/util/code-suggester/errors.d.ts +4 -0
  236. package/build/src/util/code-suggester/errors.js +24 -0
  237. package/build/src/util/code-suggester/github/branch.d.ts +45 -0
  238. package/build/src/util/code-suggester/github/branch.js +118 -0
  239. package/build/src/util/code-suggester/github/commit-and-push.d.ts +51 -0
  240. package/build/src/util/code-suggester/github/commit-and-push.js +141 -0
  241. package/build/src/util/code-suggester/github/create-commit.d.ts +20 -0
  242. package/build/src/util/code-suggester/github/create-commit.js +60 -0
  243. package/build/src/util/code-suggester/github/fork.d.ts +15 -0
  244. package/build/src/util/code-suggester/github/fork.js +48 -0
  245. package/build/src/util/code-suggester/github/labels.d.ts +14 -0
  246. package/build/src/util/code-suggester/github/labels.js +42 -0
  247. package/build/src/util/code-suggester/github/open-pull-request.d.ts +16 -0
  248. package/build/src/util/code-suggester/github/open-pull-request.js +56 -0
  249. package/build/src/util/code-suggester/index.d.ts +28 -0
  250. package/build/src/util/code-suggester/index.js +110 -0
  251. package/build/src/util/code-suggester/logger.d.ts +4 -0
  252. package/build/src/util/code-suggester/logger.js +37 -0
  253. package/build/src/util/code-suggester/types.d.ts +109 -0
  254. package/build/src/util/code-suggester/types.js +30 -0
  255. package/build/src/util/coerce-option.d.ts +1 -0
  256. package/build/src/util/coerce-option.js +40 -0
  257. package/build/src/util/commit-exclude.d.ts +10 -0
  258. package/build/src/util/commit-exclude.js +49 -0
  259. package/build/src/util/commit-split.d.ts +26 -0
  260. package/build/src/util/commit-split.js +100 -0
  261. package/build/src/util/commit-utils.d.ts +1 -0
  262. package/build/src/util/commit-utils.js +34 -0
  263. package/build/src/util/filter-commits.d.ts +12 -0
  264. package/build/src/util/filter-commits.js +59 -0
  265. package/build/src/util/indent-commit.d.ts +2 -0
  266. package/build/src/util/indent-commit.js +39 -0
  267. package/build/src/util/json-stringify.d.ts +1 -0
  268. package/build/src/util/json-stringify.js +22 -0
  269. package/build/src/util/logger.d.ts +24 -0
  270. package/build/src/util/logger.js +54 -0
  271. package/build/src/util/pull-request-body.d.ts +25 -0
  272. package/build/src/util/pull-request-body.js +147 -0
  273. package/build/src/util/pull-request-overflow-handler.d.ts +54 -0
  274. package/build/src/util/pull-request-overflow-handler.js +78 -0
  275. package/build/src/util/pull-request-title.d.ts +22 -0
  276. package/build/src/util/pull-request-title.js +146 -0
  277. package/build/src/util/signoff-commit-message.d.ts +1 -0
  278. package/build/src/util/signoff-commit-message.js +35 -0
  279. package/build/src/util/tag-name.d.ts +10 -0
  280. package/build/src/util/tag-name.js +42 -0
  281. package/build/src/util/toml-edit.d.ts +16 -0
  282. package/build/src/util/toml-edit.js +126 -0
  283. package/build/src/version.d.ts +35 -0
  284. package/build/src/version.js +74 -0
  285. package/build/src/versioning-strategies/always-bump-major.d.ts +10 -0
  286. package/build/src/versioning-strategies/always-bump-major.js +28 -0
  287. package/build/src/versioning-strategies/always-bump-minor.d.ts +10 -0
  288. package/build/src/versioning-strategies/always-bump-minor.js +28 -0
  289. package/build/src/versioning-strategies/always-bump-patch.d.ts +11 -0
  290. package/build/src/versioning-strategies/always-bump-patch.js +29 -0
  291. package/build/src/versioning-strategies/default.d.ts +48 -0
  292. package/build/src/versioning-strategies/default.js +102 -0
  293. package/build/src/versioning-strategies/dependency-manifest.d.ts +15 -0
  294. package/build/src/versioning-strategies/dependency-manifest.js +103 -0
  295. package/build/src/versioning-strategies/java-add-snapshot.d.ts +13 -0
  296. package/build/src/versioning-strategies/java-add-snapshot.js +54 -0
  297. package/build/src/versioning-strategies/java-snapshot.d.ts +13 -0
  298. package/build/src/versioning-strategies/java-snapshot.js +70 -0
  299. package/build/src/versioning-strategies/prerelease.d.ts +20 -0
  300. package/build/src/versioning-strategies/prerelease.js +163 -0
  301. package/build/src/versioning-strategies/service-pack.d.ts +12 -0
  302. package/build/src/versioning-strategies/service-pack.js +47 -0
  303. package/build/src/versioning-strategy.d.ts +90 -0
  304. package/build/src/versioning-strategy.js +82 -0
  305. package/package.json +113 -4
  306. package/schemas/config.json +513 -0
  307. package/schemas/manifest.json +9 -0
  308. package/templates/commit.hbs +2 -0
  309. package/templates/header.hbs +9 -0
  310. package/templates/template.hbs +19 -0
@@ -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
@@ -0,0 +1 @@
1
+ export declare function coerceOption(option: string): string;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ // Copyright 2019 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.coerceOption = void 0;
17
+ const fs_1 = require("fs");
18
+ // if an option looks like a file path, assume it's a
19
+ // path to a key and load it.
20
+ function coerceOption(option) {
21
+ // Only check .match if option is a string, to avoid TypeError.
22
+ // This might happen if the user didn't pass any payload for
23
+ // the option, or if the payload is empty. Example:
24
+ // --token $EMPTY_VAR
25
+ if (typeof option === 'string' && option.match(/[\\/]/)) {
26
+ try {
27
+ const stat = (0, fs_1.statSync)(option);
28
+ if (stat.isDirectory())
29
+ return option;
30
+ else
31
+ return (0, fs_1.readFileSync)(option, 'utf8').trim();
32
+ }
33
+ catch (err) {
34
+ // simply fallback to returning the original option.
35
+ }
36
+ }
37
+ return option;
38
+ }
39
+ exports.coerceOption = coerceOption;
40
+ //# sourceMappingURL=coerce-option.js.map
@@ -0,0 +1,10 @@
1
+ import { Commit } from '../commit';
2
+ import { ReleaserConfig } from '../manifest';
3
+ export type CommitExcludeConfig = Pick<ReleaserConfig, 'excludePaths'>;
4
+ export declare class CommitExclude {
5
+ private excludePaths;
6
+ constructor(config: Record<string, CommitExcludeConfig>);
7
+ excludeCommits<T extends Commit>(commitsPerPath: Record<string, T[]>): Record<string, T[]>;
8
+ private shouldInclude;
9
+ private isRelevant;
10
+ }