@release-please-oss/release-please 0.0.0-stage → 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 +279 -2
  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 +114 -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,173 @@
1
+ import { ManifestPlugin } from '../plugin';
2
+ import { CandidateReleasePullRequest, RepositoryConfig } from '../manifest';
3
+ import { Logger } from '../util/logger';
4
+ import { VersionsMap, Version } from '../version';
5
+ import { Scm } from '../scm';
6
+ export type DependencyGraph<T> = Map<string, DependencyNode<T>>;
7
+ export interface DependencyNode<T> {
8
+ deps: string[];
9
+ value: T;
10
+ }
11
+ export interface WorkspacePluginOptions {
12
+ manifestPath?: string;
13
+ updateAllPackages?: boolean;
14
+ merge?: boolean;
15
+ logger?: Logger;
16
+ }
17
+ export interface AllPackages<T> {
18
+ allPackages: T[];
19
+ candidatesByPackage: Record<string, CandidateReleasePullRequest>;
20
+ }
21
+ /**
22
+ * The plugin generalizes the logic for handling a workspace and
23
+ * will bump dependencies of managed packages if those dependencies
24
+ * are being updated.
25
+ *
26
+ * If multiple in-scope packages are being updated, it will merge them
27
+ * into a single package.
28
+ *
29
+ * This class is templatized with `T` which should be information about
30
+ * the package including the name and current version.
31
+ */
32
+ export declare abstract class WorkspacePlugin<T> extends ManifestPlugin {
33
+ private updateAllPackages;
34
+ private manifestPath;
35
+ private merge;
36
+ constructor(github: Scm, targetBranch: string, repositoryConfig: RepositoryConfig, options?: WorkspacePluginOptions);
37
+ run(candidates: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
38
+ /**
39
+ * Helper for finding a candidate release based on the package name.
40
+ * By default, we assume that the package name matches the release
41
+ * component.
42
+ * @param {T} pkg The package being released
43
+ * @param {Record<string, CandidateReleasePullRequest} candidatesByPackage
44
+ * The candidate pull requests indexed by the package name.
45
+ * @returns {CandidateReleasePullRequest | undefined} The associated
46
+ * candidate release or undefined if there is no existing release yet
47
+ */
48
+ protected findCandidateForPackage(pkg: T, candidatesByPackage: Record<string, CandidateReleasePullRequest>): CandidateReleasePullRequest | undefined;
49
+ /**
50
+ * Helper to determine which packages we will use to base our search
51
+ * for touched packages upon. These are usually the packages that
52
+ * have candidate pull requests open.
53
+ *
54
+ * If you configure `updateAllPackages`, we fill force update all
55
+ * packages as if they had a release.
56
+ * @param {DependencyGraph<T>} graph All the packages in the repository
57
+ * @param {Record<string, CandidateReleasePullRequest} candidatesByPackage
58
+ * The candidate pull requests indexed by the package name.
59
+ * @returns {string[]} Package names to
60
+ */
61
+ protected packageNamesToUpdate(graph: DependencyGraph<T>, candidatesByPackage: Record<string, CandidateReleasePullRequest>): string[];
62
+ /**
63
+ * Helper to build up all the versions we are modifying in this
64
+ * repository.
65
+ * @param {DependencyGraph<T>} _graph All the packages in the repository
66
+ * @param {T[]} orderedPackages A list of packages that are currently
67
+ * updated by the existing candidate pull requests
68
+ * @param {Record<string, CandidateReleasePullRequest} candidatesByPackage
69
+ * The candidate pull requests indexed by the package name.
70
+ * @returns A map of all updated versions (package name => Version) and a
71
+ * map of all updated versions (component path => Version).
72
+ */
73
+ protected buildUpdatedVersions(_graph: DependencyGraph<T>, orderedPackages: T[], candidatesByPackage: Record<string, CandidateReleasePullRequest>): Promise<{
74
+ updatedVersions: VersionsMap;
75
+ updatedPathVersions: VersionsMap;
76
+ }>;
77
+ /**
78
+ * Given a release version, determine if we should bump the manifest
79
+ * version as well.
80
+ * @param {Version} _version The release version
81
+ */
82
+ protected isReleaseVersion(_version: Version): boolean;
83
+ /**
84
+ * Given a package, return the new bumped version after updating
85
+ * the dependency.
86
+ * @param {T} pkg The package being updated
87
+ */
88
+ protected abstract bumpVersion(pkg: T): Version;
89
+ /**
90
+ * Update an existing candidate pull request to append new
91
+ * dependency updates into the versions and changelog.
92
+ * @param {CandidateReleasePullRequest} existingCandidate The existing
93
+ * candidate pull request.
94
+ * @param {T} pkg The package being updated
95
+ * @param {VersionsMap} updatedVersions Map of package name => version to
96
+ * update.
97
+ * @returns {CandidateReleasePullRequest} The updated pull request
98
+ */
99
+ protected abstract updateCandidate(existingCandidate: CandidateReleasePullRequest, pkg: T, updatedVersions: VersionsMap): CandidateReleasePullRequest;
100
+ /**
101
+ * Create a new candidate pull request to update dependencies and force
102
+ * a version bump.
103
+ * @param {T} pkg The package being updated
104
+ * @param {VersionsMap} updatedVersions Map of package name => version to
105
+ * update.
106
+ * @returns {CandidateReleasePullRequest} A new pull request
107
+ */
108
+ protected abstract newCandidate(pkg: T, updatedVersions: VersionsMap): Promise<CandidateReleasePullRequest>;
109
+ /**
110
+ * Collect all packages being managed in this workspace.
111
+ * @param {CanididateReleasePullRequest[]} candidates Existing candidate pull
112
+ * requests
113
+ * @returns {AllPackages<T>} The list of packages and candidates grouped by package name
114
+ */
115
+ protected abstract buildAllPackages(candidates: CandidateReleasePullRequest[]): Promise<AllPackages<T>>;
116
+ /**
117
+ * Builds a graph of dependencies that have been touched
118
+ * @param {T[]} allPackages All the packages in the workspace
119
+ * @returns {DependencyGraph<T>} A map of package name to other workspace packages
120
+ * it depends on.
121
+ */
122
+ protected abstract buildGraph(allPackages: T[]): Promise<DependencyGraph<T>>;
123
+ /**
124
+ * Filter to determine whether or not the candidate pull request is
125
+ * in scope of this workspace.
126
+ * @param {CandidateReleasePullRequest} candidate The candidate pull request
127
+ * @returns {boolean} Whether or not this candidate should be handled by this
128
+ * workspace.
129
+ */
130
+ protected abstract inScope(candidate: CandidateReleasePullRequest): boolean;
131
+ /**
132
+ * Given a package, return the package name of the package.
133
+ * @param {T} pkg The package definition.
134
+ * @returns {string} The package name.
135
+ */
136
+ protected abstract packageNameFromPackage(pkg: T): string;
137
+ /**
138
+ * Given a package, return the path in the repo to the package.
139
+ * @param {T} pkg The package definition.
140
+ * @returns {string} The package path.
141
+ */
142
+ protected abstract pathFromPackage(pkg: T): string;
143
+ /**
144
+ * Amend any or all in-scope candidates once all other processing has occured.
145
+ *
146
+ * This gives the workspace plugin once last chance to tweak the pull-requests
147
+ * once all the underlying information has been collated.
148
+ * @param {CandidateReleasePullRequest[]} candidates - The list of candidates
149
+ * once all other workspace processing has occured.
150
+ * @param {VersionMap} updatedVersions - Map containing any component versions
151
+ * that have changed.
152
+ * @returns {CandidateReleasePullRequest[]} potentially amended list of
153
+ * candidates.
154
+ */
155
+ protected abstract postProcessCandidates(candidates: CandidateReleasePullRequest[], updatedVersions: VersionsMap): CandidateReleasePullRequest[];
156
+ /**
157
+ * Helper to invert the graph from package => packages that it depends on
158
+ * to package => packages that depend on it.
159
+ * @param {DependencyGraph<T>} graph
160
+ * @returns {DependencyGraph<T>}
161
+ */
162
+ private invertGraph;
163
+ /**
164
+ * Determine all the packages which need to be updated and sort them.
165
+ * @param {DependencyGraph<T>} graph The graph of package => packages it depends on
166
+ * @param {string} packageNamesToUpdate Names of the packages which are already
167
+ * being updated.
168
+ */
169
+ protected buildGraphOrder(graph: DependencyGraph<T>, packageNamesToUpdate: string[]): T[];
170
+ private visitPostOrder;
171
+ }
172
+ export declare function appendDependenciesSectionToChangelog(changelog: string, notes: string, logger?: Logger): string;
173
+ export declare function addPath(path: string, file: string): string;
@@ -0,0 +1,308 @@
1
+ "use strict";
2
+ // Copyright 2021 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.addPath = exports.appendDependenciesSectionToChangelog = exports.WorkspacePlugin = void 0;
17
+ const plugin_1 = require("../plugin");
18
+ const manifest_1 = require("../manifest");
19
+ const logger_1 = require("../util/logger");
20
+ const merge_1 = require("./merge");
21
+ const release_please_manifest_1 = require("../updaters/release-please-manifest");
22
+ /**
23
+ * The plugin generalizes the logic for handling a workspace and
24
+ * will bump dependencies of managed packages if those dependencies
25
+ * are being updated.
26
+ *
27
+ * If multiple in-scope packages are being updated, it will merge them
28
+ * into a single package.
29
+ *
30
+ * This class is templatized with `T` which should be information about
31
+ * the package including the name and current version.
32
+ */
33
+ class WorkspacePlugin extends plugin_1.ManifestPlugin {
34
+ constructor(github, targetBranch, repositoryConfig, options = {}) {
35
+ var _a, _b, _c;
36
+ super(github, targetBranch, repositoryConfig, options.logger);
37
+ this.manifestPath = (_a = options.manifestPath) !== null && _a !== void 0 ? _a : manifest_1.DEFAULT_RELEASE_PLEASE_MANIFEST;
38
+ this.updateAllPackages = (_b = options.updateAllPackages) !== null && _b !== void 0 ? _b : false;
39
+ this.merge = (_c = options.merge) !== null && _c !== void 0 ? _c : true;
40
+ }
41
+ async run(candidates) {
42
+ this.logger.info('Running workspace plugin');
43
+ const [inScopeCandidates, outOfScopeCandidates] = candidates.reduce((collection, candidate) => {
44
+ if (!candidate.pullRequest.version) {
45
+ this.logger.warn('pull request missing version', candidate);
46
+ return collection;
47
+ }
48
+ if (this.inScope(candidate)) {
49
+ collection[0].push(candidate);
50
+ }
51
+ else {
52
+ collection[1].push(candidate);
53
+ }
54
+ return collection;
55
+ }, [[], []]);
56
+ this.logger.info(`Found ${inScopeCandidates.length} in-scope releases`);
57
+ if (inScopeCandidates.length === 0) {
58
+ return outOfScopeCandidates;
59
+ }
60
+ this.logger.info('Building list of all packages');
61
+ const { allPackages, candidatesByPackage } = await this.buildAllPackages(inScopeCandidates);
62
+ this.logger.info(`Building dependency graph for ${allPackages.length} packages`);
63
+ const graph = await this.buildGraph(allPackages);
64
+ const packageNamesToUpdate = this.packageNamesToUpdate(graph, candidatesByPackage);
65
+ const orderedPackages = this.buildGraphOrder(graph, packageNamesToUpdate);
66
+ this.logger.info(`Updating ${orderedPackages.length} packages`);
67
+ const { updatedVersions, updatedPathVersions } = await this.buildUpdatedVersions(graph, orderedPackages, candidatesByPackage);
68
+ let newCandidates = [];
69
+ // In some cases, there are multiple packages within a single candidate. We
70
+ // only want to process each candidate package once.
71
+ const newCandidatePaths = new Set();
72
+ for (const pkg of orderedPackages) {
73
+ const existingCandidate = this.findCandidateForPackage(pkg, candidatesByPackage);
74
+ if (existingCandidate) {
75
+ // if already has an pull request, update the changelog and update
76
+ this.logger.info(`Updating existing candidate pull request for ${this.packageNameFromPackage(pkg)}, path: ${existingCandidate.path}`);
77
+ if (newCandidatePaths.has(existingCandidate.path)) {
78
+ this.logger.info(`Already updated candidate for path: ${existingCandidate.path}`);
79
+ }
80
+ else {
81
+ const newCandidate = this.updateCandidate(existingCandidate, pkg, updatedVersions);
82
+ newCandidatePaths.add(newCandidate.path);
83
+ newCandidates.push(newCandidate);
84
+ }
85
+ }
86
+ else {
87
+ // otherwise, build a new pull request with changelog and entry update
88
+ this.logger.info(`Creating new candidate pull request for ${this.packageNameFromPackage(pkg)}`);
89
+ const newCandidate = await this.newCandidate(pkg, updatedVersions);
90
+ if (newCandidatePaths.has(newCandidate.path)) {
91
+ this.logger.info(`Already created new candidate for path: ${newCandidate.path}`);
92
+ }
93
+ else {
94
+ newCandidatePaths.add(newCandidate.path);
95
+ newCandidates.push(newCandidate);
96
+ }
97
+ }
98
+ }
99
+ if (this.merge) {
100
+ this.logger.info(`Merging ${newCandidates.length} in-scope candidates`);
101
+ const mergePlugin = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig);
102
+ newCandidates = await mergePlugin.run(newCandidates);
103
+ }
104
+ const newUpdates = newCandidates[0].pullRequest.updates;
105
+ newUpdates.push({
106
+ path: this.manifestPath,
107
+ createIfMissing: false,
108
+ updater: new release_please_manifest_1.ReleasePleaseManifest({
109
+ version: newCandidates[0].pullRequest.version,
110
+ versionsMap: updatedPathVersions,
111
+ }),
112
+ });
113
+ this.logger.info(`Post-processing ${newCandidates.length} in-scope candidates`);
114
+ newCandidates = this.postProcessCandidates(newCandidates, updatedVersions);
115
+ return [...outOfScopeCandidates, ...newCandidates];
116
+ }
117
+ /**
118
+ * Helper for finding a candidate release based on the package name.
119
+ * By default, we assume that the package name matches the release
120
+ * component.
121
+ * @param {T} pkg The package being released
122
+ * @param {Record<string, CandidateReleasePullRequest} candidatesByPackage
123
+ * The candidate pull requests indexed by the package name.
124
+ * @returns {CandidateReleasePullRequest | undefined} The associated
125
+ * candidate release or undefined if there is no existing release yet
126
+ */
127
+ findCandidateForPackage(pkg, candidatesByPackage) {
128
+ const packageName = this.packageNameFromPackage(pkg);
129
+ return candidatesByPackage[packageName];
130
+ }
131
+ /**
132
+ * Helper to determine which packages we will use to base our search
133
+ * for touched packages upon. These are usually the packages that
134
+ * have candidate pull requests open.
135
+ *
136
+ * If you configure `updateAllPackages`, we fill force update all
137
+ * packages as if they had a release.
138
+ * @param {DependencyGraph<T>} graph All the packages in the repository
139
+ * @param {Record<string, CandidateReleasePullRequest} candidatesByPackage
140
+ * The candidate pull requests indexed by the package name.
141
+ * @returns {string[]} Package names to
142
+ */
143
+ packageNamesToUpdate(graph, candidatesByPackage) {
144
+ if (this.updateAllPackages) {
145
+ return Array.from(graph.values()).map(({ value }) => this.packageNameFromPackage(value));
146
+ }
147
+ return Object.keys(candidatesByPackage);
148
+ }
149
+ /**
150
+ * Helper to build up all the versions we are modifying in this
151
+ * repository.
152
+ * @param {DependencyGraph<T>} _graph All the packages in the repository
153
+ * @param {T[]} orderedPackages A list of packages that are currently
154
+ * updated by the existing candidate pull requests
155
+ * @param {Record<string, CandidateReleasePullRequest} candidatesByPackage
156
+ * The candidate pull requests indexed by the package name.
157
+ * @returns A map of all updated versions (package name => Version) and a
158
+ * map of all updated versions (component path => Version).
159
+ */
160
+ async buildUpdatedVersions(_graph, orderedPackages, candidatesByPackage) {
161
+ const updatedVersions = new Map();
162
+ const updatedPathVersions = new Map();
163
+ for (const pkg of orderedPackages) {
164
+ const packageName = this.packageNameFromPackage(pkg);
165
+ this.logger.debug(`package: ${packageName}`);
166
+ const existingCandidate = candidatesByPackage[packageName];
167
+ if (existingCandidate) {
168
+ const version = existingCandidate.pullRequest.version;
169
+ this.logger.debug(`version: ${version} from release-please`);
170
+ updatedVersions.set(packageName, version);
171
+ }
172
+ else {
173
+ const version = this.bumpVersion(pkg);
174
+ this.logger.debug(`version: ${version} forced bump`);
175
+ updatedVersions.set(packageName, version);
176
+ if (this.isReleaseVersion(version)) {
177
+ updatedPathVersions.set(this.pathFromPackage(pkg), version);
178
+ }
179
+ }
180
+ }
181
+ return {
182
+ updatedVersions,
183
+ updatedPathVersions,
184
+ };
185
+ }
186
+ /**
187
+ * Given a release version, determine if we should bump the manifest
188
+ * version as well.
189
+ * @param {Version} _version The release version
190
+ */
191
+ isReleaseVersion(_version) {
192
+ return true;
193
+ }
194
+ /**
195
+ * Helper to invert the graph from package => packages that it depends on
196
+ * to package => packages that depend on it.
197
+ * @param {DependencyGraph<T>} graph
198
+ * @returns {DependencyGraph<T>}
199
+ */
200
+ invertGraph(graph) {
201
+ const dependentGraph = new Map();
202
+ for (const [packageName, node] of graph) {
203
+ dependentGraph.set(packageName, {
204
+ deps: [],
205
+ value: node.value,
206
+ });
207
+ }
208
+ for (const [packageName, node] of graph) {
209
+ for (const depName of node.deps) {
210
+ if (dependentGraph.has(depName)) {
211
+ dependentGraph.get(depName).deps.push(packageName);
212
+ }
213
+ }
214
+ }
215
+ return dependentGraph;
216
+ }
217
+ /**
218
+ * Determine all the packages which need to be updated and sort them.
219
+ * @param {DependencyGraph<T>} graph The graph of package => packages it depends on
220
+ * @param {string} packageNamesToUpdate Names of the packages which are already
221
+ * being updated.
222
+ */
223
+ buildGraphOrder(graph, packageNamesToUpdate) {
224
+ this.logger.info(`building graph order, existing package names: ${packageNamesToUpdate}`);
225
+ // invert the graph so it's dependency name => packages that depend on it
226
+ const dependentGraph = this.invertGraph(graph);
227
+ const visited = new Set();
228
+ // we're iterating the `Map` in insertion order (as per ECMA262), but
229
+ // that does not reflect any particular traversal of the graph, so we
230
+ // visit all nodes, opportunistically short-circuiting leafs when we've
231
+ // already visited them.
232
+ for (const name of packageNamesToUpdate) {
233
+ this.visitPostOrder(dependentGraph, name, visited, []);
234
+ }
235
+ return Array.from(visited).sort((a, b) => this.packageNameFromPackage(a).localeCompare(this.packageNameFromPackage(b)));
236
+ }
237
+ visitPostOrder(graph, name, visited, path) {
238
+ this.logger.debug(`visiting ${name}, path: ${path}`);
239
+ if (path.indexOf(name) !== -1) {
240
+ throw new Error(`found cycle in dependency graph: ${path.join(' -> ')} -> ${name}`);
241
+ }
242
+ const node = graph.get(name);
243
+ if (!node) {
244
+ this.logger.warn(`Didn't find node: ${name} in graph`);
245
+ return;
246
+ }
247
+ const nextPath = [...path, name];
248
+ for (const depName of node.deps) {
249
+ const dep = graph.get(depName);
250
+ if (!dep) {
251
+ this.logger.warn(`dependency not found in graph: ${depName}`);
252
+ return;
253
+ }
254
+ this.logger.info(`visiting ${depName} next`);
255
+ this.visitPostOrder(graph, depName, visited, nextPath);
256
+ }
257
+ if (!visited.has(node.value)) {
258
+ this.logger.debug(`marking ${name} as visited and adding ${this.packageNameFromPackage(node.value)} to order`);
259
+ visited.add(node.value);
260
+ }
261
+ else {
262
+ this.logger.debug(`${node.value} already visited`);
263
+ }
264
+ }
265
+ }
266
+ exports.WorkspacePlugin = WorkspacePlugin;
267
+ const DEPENDENCY_HEADER = new RegExp('### Dependencies');
268
+ function appendDependenciesSectionToChangelog(changelog, notes, logger = logger_1.logger) {
269
+ if (!changelog) {
270
+ return `### Dependencies\n\n${notes}`;
271
+ }
272
+ logger.info('appending dependency notes to changelog');
273
+ const newLines = [];
274
+ let seenDependenciesSection = false;
275
+ let seenDependencySectionSpacer = false;
276
+ let injected = false;
277
+ for (const line of changelog.split('\n')) {
278
+ if (seenDependenciesSection) {
279
+ const trimmedLine = line.trim();
280
+ if (seenDependencySectionSpacer &&
281
+ !injected &&
282
+ !trimmedLine.startsWith('*')) {
283
+ newLines.push(changelog);
284
+ injected = true;
285
+ }
286
+ if (trimmedLine === '') {
287
+ seenDependencySectionSpacer = true;
288
+ }
289
+ }
290
+ if (line.match(DEPENDENCY_HEADER)) {
291
+ seenDependenciesSection = true;
292
+ }
293
+ newLines.push(line);
294
+ }
295
+ if (injected) {
296
+ return newLines.join('\n');
297
+ }
298
+ if (seenDependenciesSection) {
299
+ return `${changelog}\n${notes}`;
300
+ }
301
+ return `${changelog}\n\n\n### Dependencies\n\n${notes}`;
302
+ }
303
+ exports.appendDependenciesSectionToChangelog = appendDependenciesSectionToChangelog;
304
+ function addPath(path, file) {
305
+ return path === manifest_1.ROOT_PROJECT_PATH ? file : `${path}/${file}`;
306
+ }
307
+ exports.addPath = addPath;
308
+ //# sourceMappingURL=workspace.js.map
@@ -0,0 +1,11 @@
1
+ export interface PullRequest {
2
+ readonly headBranchName: string;
3
+ readonly baseBranchName: string;
4
+ readonly number: number;
5
+ readonly mergeCommitOid?: string;
6
+ readonly title: string;
7
+ readonly body: string;
8
+ readonly labels: string[];
9
+ readonly files: string[];
10
+ readonly sha?: string;
11
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // Copyright 2021 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
+ //# sourceMappingURL=pull-request.js.map
@@ -0,0 +1,14 @@
1
+ import { Update } from './update';
2
+ import { Version } from './version';
3
+ import { PullRequestBody } from './util/pull-request-body';
4
+ import { PullRequestTitle } from './util/pull-request-title';
5
+ export interface ReleasePullRequest {
6
+ readonly title: PullRequestTitle;
7
+ readonly body: PullRequestBody;
8
+ readonly labels: string[];
9
+ readonly headRefName: string;
10
+ readonly version?: Version;
11
+ readonly draft: boolean;
12
+ readonly group?: string;
13
+ updates: Update[];
14
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // Copyright 2021 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
+ //# sourceMappingURL=release-pull-request.js.map
@@ -0,0 +1,7 @@
1
+ import { TagName } from './util/tag-name';
2
+ export interface Release {
3
+ readonly name?: string;
4
+ readonly tag: TagName;
5
+ readonly sha: string;
6
+ readonly notes: string;
7
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // Copyright 2021 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
+ //# sourceMappingURL=release.js.map
@@ -0,0 +1,5 @@
1
+ export interface Repository {
2
+ readonly owner: string;
3
+ readonly repo: string;
4
+ readonly defaultBranch: string;
5
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // Copyright 2021 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
+ //# sourceMappingURL=repository.js.map
@@ -0,0 +1,80 @@
1
+ import { Repository } from './repository';
2
+ import { Commit } from './commit';
3
+ import { PullRequest } from './pull-request';
4
+ import { ReleasePullRequest } from './release-pull-request';
5
+ import { Update } from './update';
6
+ import { Release } from './release';
7
+ import { GitHubFileContents } from '@google-automations/git-file-utils';
8
+ import { PullRequestOverflowHandler } from './util/pull-request-overflow-handler';
9
+ export interface ScmFileDiff {
10
+ readonly mode: '100644' | '100755' | '040000' | '160000' | '120000';
11
+ readonly content: string | null;
12
+ readonly originalContent: string | null;
13
+ }
14
+ export type ScmChangeSet = Map<string, ScmFileDiff>;
15
+ export interface ScmCommitIteratorOptions {
16
+ maxResults?: number;
17
+ backfillFiles?: boolean;
18
+ batchSize?: number;
19
+ }
20
+ export interface ScmReleaseIteratorOptions {
21
+ maxResults?: number;
22
+ }
23
+ export interface ScmTagIteratorOptions {
24
+ maxResults?: number;
25
+ }
26
+ export interface ScmCreatePullRequestOptions {
27
+ fork?: boolean;
28
+ draft?: boolean;
29
+ }
30
+ export interface ScmUpdatePullRequestOptions {
31
+ signoffUser?: string;
32
+ fork?: boolean;
33
+ pullRequestOverflowHandler?: PullRequestOverflowHandler;
34
+ }
35
+ export interface ScmReleaseOptions {
36
+ draft?: boolean;
37
+ prerelease?: boolean;
38
+ forceTag?: boolean;
39
+ }
40
+ export interface ScmRelease {
41
+ id: number;
42
+ name?: string;
43
+ tagName: string;
44
+ sha: string;
45
+ notes?: string;
46
+ url: string;
47
+ draft?: boolean;
48
+ uploadUrl?: string;
49
+ }
50
+ export interface ScmTag {
51
+ name: string;
52
+ sha: string;
53
+ }
54
+ export interface Scm {
55
+ readonly repository: Repository;
56
+ getFileContents(path: string): Promise<GitHubFileContents>;
57
+ getFileContentsOnBranch(path: string, branch: string): Promise<GitHubFileContents>;
58
+ getFileJson<T>(path: string, branch: string): Promise<T>;
59
+ findFilesByFilename(filename: string, prefix?: string): Promise<string[]>;
60
+ findFilesByFilenameAndRef(filename: string, ref: string, prefix?: string): Promise<string[]>;
61
+ findFilesByGlob(glob: string, prefix?: string): Promise<string[]>;
62
+ findFilesByGlobAndRef(glob: string, ref: string, prefix?: string): Promise<string[]>;
63
+ findFilesByExtension(extension: string, prefix?: string): Promise<string[]>;
64
+ findFilesByExtensionAndRef(extension: string, ref: string, prefix?: string): Promise<string[]>;
65
+ commitsSince(targetBranch: string, filter: (commit: Commit) => boolean, options?: ScmCommitIteratorOptions): Promise<Commit[]>;
66
+ mergeCommitIterator(targetBranch: string, options?: ScmCommitIteratorOptions): AsyncGenerator<Commit, void, void>;
67
+ pullRequestIterator(targetBranch: string, status?: 'OPEN' | 'CLOSED' | 'MERGED', maxResults?: number, includeFiles?: boolean): AsyncGenerator<PullRequest, void, void>;
68
+ releaseIterator(options?: ScmReleaseIteratorOptions): AsyncGenerator<ScmRelease, void, void>;
69
+ tagIterator(options?: ScmTagIteratorOptions): AsyncGenerator<ScmTag, void, void>;
70
+ createPullRequest(pullRequest: PullRequest, targetBranch: string, message: string, updates: Update[], options?: ScmCreatePullRequestOptions): Promise<PullRequest>;
71
+ updatePullRequest(number: number, pullRequest: ReleasePullRequest, targetBranch: string, options?: ScmUpdatePullRequestOptions): Promise<PullRequest>;
72
+ getPullRequest(number: number): Promise<PullRequest>;
73
+ createRelease(release: Release, options?: ScmReleaseOptions): Promise<ScmRelease>;
74
+ commentOnIssue(comment: string, number: number): Promise<string>;
75
+ removeIssueLabels(labels: string[], number: number): Promise<void>;
76
+ addIssueLabels(labels: string[], number: number): Promise<void>;
77
+ generateReleaseNotes(tagName: string, targetCommitish: string, previousTag?: string): Promise<string>;
78
+ createFileOnNewBranch(filename: string, contents: string, newBranchName: string, baseBranchName: string): Promise<string>;
79
+ buildChangeSet(updates: Update[], defaultBranch: string): Promise<ScmChangeSet>;
80
+ }