release-please 12.6.0 → 13.0.0-candidate.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 (251) hide show
  1. package/build/src/bin/release-please.d.ts +55 -13
  2. package/build/src/bin/release-please.js +419 -159
  3. package/build/src/bootstrapper.d.ts +12 -0
  4. package/build/src/bootstrapper.js +60 -0
  5. package/build/src/changelog-notes/default.d.ts +17 -0
  6. package/build/src/changelog-notes/default.js +72 -0
  7. package/build/src/changelog-notes.d.ts +17 -0
  8. package/build/src/{updaters/java/readme.js → changelog-notes.js} +2 -7
  9. package/build/src/commit.d.ts +26 -0
  10. package/build/src/{util/to-conventional-changelog-format.js → commit.js} +97 -2
  11. package/build/src/errors/index.d.ts +0 -5
  12. package/build/src/errors/index.js +1 -10
  13. package/build/src/factory.d.ts +25 -37
  14. package/build/src/factory.js +160 -151
  15. package/build/src/github.d.ts +154 -885
  16. package/build/src/github.js +608 -1037
  17. package/build/src/manifest.d.ts +191 -47
  18. package/build/src/manifest.js +599 -487
  19. package/build/src/plugin.d.ts +20 -0
  20. package/build/src/{plugins/plugin.js → plugin.js} +10 -9
  21. package/build/src/plugins/cargo-workspace.d.ts +48 -18
  22. package/build/src/plugins/cargo-workspace.js +247 -328
  23. package/build/src/plugins/merge.d.ts +11 -0
  24. package/build/src/plugins/merge.js +83 -0
  25. package/build/src/plugins/node-workspace.d.ts +35 -17
  26. package/build/src/plugins/node-workspace.js +234 -271
  27. package/build/src/plugins/workspace.d.ts +102 -0
  28. package/build/src/plugins/workspace.js +170 -0
  29. package/build/src/pull-request.d.ts +10 -0
  30. package/build/src/{updaters/java/pom-xml.js → pull-request.js} +2 -7
  31. package/build/src/release-notes.d.ts +29 -0
  32. package/build/src/release-notes.js +71 -0
  33. package/build/src/release-pull-request.d.ts +13 -0
  34. package/build/src/release-pull-request.js +16 -0
  35. package/build/src/release.d.ts +6 -0
  36. package/build/src/release.js +16 -0
  37. package/build/src/repository.d.ts +5 -0
  38. package/build/src/repository.js +16 -0
  39. package/build/src/strategies/dart.d.ts +8 -0
  40. package/build/src/strategies/dart.js +63 -0
  41. package/build/src/strategies/elixir.d.ts +5 -0
  42. package/build/src/{releasers → strategies}/elixir.js +18 -14
  43. package/build/src/strategies/go-yoshi.d.ts +13 -0
  44. package/build/src/strategies/go-yoshi.js +106 -0
  45. package/build/src/strategies/go.d.ts +5 -0
  46. package/build/src/{releasers → strategies}/go.js +11 -12
  47. package/build/src/strategies/helm.d.ts +8 -0
  48. package/build/src/strategies/helm.js +63 -0
  49. package/build/src/strategies/java-yoshi.d.ts +24 -0
  50. package/build/src/strategies/java-yoshi.js +203 -0
  51. package/build/src/strategies/krm-blueprint.d.ts +7 -0
  52. package/build/src/{releasers → strategies}/krm-blueprint.js +26 -22
  53. package/build/src/strategies/node.d.ts +9 -0
  54. package/build/src/strategies/node.js +82 -0
  55. package/build/src/strategies/ocaml.d.ts +5 -0
  56. package/build/src/{releasers → strategies}/ocaml.js +34 -28
  57. package/build/src/strategies/php-yoshi.d.ts +10 -0
  58. package/build/src/strategies/php-yoshi.js +213 -0
  59. package/build/src/strategies/php.d.ts +6 -0
  60. package/build/src/{releasers → strategies}/php.js +24 -23
  61. package/build/src/strategies/python.d.ts +8 -0
  62. package/build/src/strategies/python.js +117 -0
  63. package/build/src/strategies/ruby-yoshi.d.ts +17 -0
  64. package/build/src/strategies/ruby-yoshi.js +116 -0
  65. package/build/src/strategies/ruby.d.ts +13 -0
  66. package/build/src/{releasers → strategies}/ruby.js +26 -27
  67. package/build/src/strategies/rust.d.ts +20 -0
  68. package/build/src/strategies/rust.js +120 -0
  69. package/build/src/strategies/simple.d.ts +5 -0
  70. package/build/src/{releasers → strategies}/simple.js +18 -14
  71. package/build/src/strategies/terraform-module.d.ts +7 -0
  72. package/build/src/{releasers → strategies}/terraform-module.js +29 -23
  73. package/build/src/strategy.d.ts +100 -0
  74. package/build/src/strategy.js +242 -0
  75. package/build/src/update.d.ts +23 -0
  76. package/build/src/{updaters/update.js → update.js} +1 -1
  77. package/build/src/updaters/changelog.d.ts +7 -10
  78. package/build/src/updaters/changelog.js +3 -9
  79. package/build/src/updaters/changelog.js.map +1 -1
  80. package/build/src/updaters/composite.d.ts +19 -0
  81. package/build/src/updaters/composite.js +42 -0
  82. package/build/src/updaters/dart/pubspec-yaml.d.ts +12 -0
  83. package/build/src/updaters/{pubspec-yaml.js → dart/pubspec-yaml.js} +13 -12
  84. package/build/src/updaters/default.d.ts +21 -0
  85. package/build/src/updaters/{version-txt.js → default.js} +16 -10
  86. package/build/src/updaters/dotnet/csproj.d.ts +12 -0
  87. package/build/src/updaters/{java/google-utils.js → dotnet/csproj.js} +16 -13
  88. package/build/src/updaters/elixir/elixir-mix-exs.d.ts +12 -0
  89. package/build/src/updaters/{elixir-mix-exs.js → elixir/elixir-mix-exs.js} +12 -10
  90. package/build/src/updaters/helm/chart-yaml.d.ts +10 -11
  91. package/build/src/updaters/helm/chart-yaml.js +12 -10
  92. package/build/src/updaters/java/java-update.d.ts +14 -0
  93. package/build/src/updaters/java/{java_update.js → java-update.js} +22 -22
  94. package/build/src/updaters/java/versions-manifest.d.ts +12 -2
  95. package/build/src/updaters/java/versions-manifest.js +20 -4
  96. package/build/src/updaters/krm/krm-blueprint-version.d.ts +10 -11
  97. package/build/src/updaters/krm/krm-blueprint-version.js +13 -12
  98. package/build/src/updaters/node/package-json.d.ts +12 -0
  99. package/build/src/updaters/{package-json.js → node/package-json.js} +14 -16
  100. package/build/src/updaters/node/package-lock-json.d.ts +8 -0
  101. package/build/src/updaters/node/package-lock-json.js +36 -0
  102. package/build/src/updaters/node/samples-package-json.d.ts +23 -0
  103. package/build/src/updaters/{samples-package-json.js → node/samples-package-json.js} +19 -8
  104. package/build/src/updaters/ocaml/dune-project.d.ts +10 -11
  105. package/build/src/updaters/ocaml/dune-project.js +11 -9
  106. package/build/src/updaters/ocaml/esy-json.d.ts +10 -11
  107. package/build/src/updaters/ocaml/esy-json.js +12 -10
  108. package/build/src/updaters/ocaml/opam.d.ts +10 -11
  109. package/build/src/updaters/ocaml/opam.js +11 -9
  110. package/build/src/updaters/php/php-client-version.d.ts +12 -0
  111. package/build/src/updaters/{php-client-version.js → php/php-client-version.js} +10 -9
  112. package/build/src/updaters/php/php-manifest.d.ts +13 -0
  113. package/build/src/updaters/{php-manifest.js → php/php-manifest.js} +17 -15
  114. package/build/src/updaters/php/root-composer-update-packages.d.ts +12 -0
  115. package/build/src/updaters/{root-composer-update-packages.js → php/root-composer-update-packages.js} +17 -16
  116. package/build/src/updaters/python/pyproject-toml.d.ts +10 -11
  117. package/build/src/updaters/python/pyproject-toml.js +13 -11
  118. package/build/src/updaters/python/python-file-with-version.d.ts +7 -11
  119. package/build/src/updaters/python/python-file-with-version.js +7 -8
  120. package/build/src/updaters/python/setup-cfg.d.ts +10 -11
  121. package/build/src/updaters/python/setup-cfg.js +10 -8
  122. package/build/src/updaters/python/setup-py.d.ts +10 -11
  123. package/build/src/updaters/python/setup-py.js +10 -8
  124. package/build/src/updaters/raw-content.d.ts +19 -0
  125. package/build/src/{plugins/index.js → updaters/raw-content.js} +23 -12
  126. package/build/src/updaters/release-please-config.d.ts +8 -0
  127. package/build/src/updaters/release-please-config.js +41 -0
  128. package/build/src/updaters/release-please-manifest.d.ts +2 -11
  129. package/build/src/updaters/release-please-manifest.js +11 -14
  130. package/build/src/updaters/ruby/version-rb.d.ts +12 -0
  131. package/build/src/updaters/{version-rb.js → ruby/version-rb.js} +10 -8
  132. package/build/src/updaters/rust/cargo-lock.d.ts +7 -11
  133. package/build/src/updaters/rust/cargo-lock.js +14 -16
  134. package/build/src/updaters/rust/cargo-toml.d.ts +7 -11
  135. package/build/src/updaters/rust/cargo-toml.js +19 -21
  136. package/build/src/updaters/terraform/module-version.d.ts +10 -11
  137. package/build/src/updaters/terraform/module-version.js +11 -9
  138. package/build/src/updaters/terraform/readme.d.ts +10 -11
  139. package/build/src/updaters/terraform/readme.js +11 -10
  140. package/build/src/updaters/terraform/readme.js.map +1 -1
  141. package/build/src/util/branch-name.d.ts +5 -4
  142. package/build/src/util/branch-name.js +13 -10
  143. package/build/src/{commit-split.d.ts → util/commit-split.d.ts} +2 -4
  144. package/build/src/{commit-split.js → util/commit-split.js} +4 -2
  145. package/build/src/util/indent-commit.d.ts +1 -1
  146. package/build/src/util/logger.d.ts +5 -2
  147. package/build/src/util/logger.js +9 -4
  148. package/build/src/util/pull-request-body.d.ts +20 -0
  149. package/build/src/util/pull-request-body.js +129 -0
  150. package/build/src/util/pull-request-title.d.ts +8 -6
  151. package/build/src/util/pull-request-title.js +20 -6
  152. package/build/src/util/tag-name.d.ts +9 -0
  153. package/build/src/util/tag-name.js +41 -0
  154. package/build/src/{updaters → util}/toml-edit.d.ts +0 -0
  155. package/build/src/{updaters → util}/toml-edit.js +0 -0
  156. package/build/src/version.d.ts +11 -0
  157. package/build/src/version.js +45 -0
  158. package/build/src/versioning-strategies/always-bump-patch.d.ts +7 -0
  159. package/build/src/{updaters/package-lock-json.js → versioning-strategies/always-bump-patch.js} +8 -11
  160. package/build/src/versioning-strategies/default.d.ts +15 -0
  161. package/build/src/versioning-strategies/default.js +67 -0
  162. package/build/src/versioning-strategies/dependency-manifest.d.ts +7 -0
  163. package/build/src/versioning-strategies/dependency-manifest.js +90 -0
  164. package/build/src/versioning-strategies/java-add-snapshot.d.ts +9 -0
  165. package/build/src/versioning-strategies/java-add-snapshot.js +53 -0
  166. package/build/src/versioning-strategies/java-snapshot.d.ts +9 -0
  167. package/build/src/versioning-strategies/java-snapshot.js +67 -0
  168. package/build/src/versioning-strategies/service-pack.d.ts +7 -0
  169. package/build/src/versioning-strategies/service-pack.js +40 -0
  170. package/build/src/versioning-strategy.d.ts +28 -0
  171. package/build/src/versioning-strategy.js +55 -0
  172. package/package.json +8 -7
  173. package/build/src/constants.d.ts +0 -7
  174. package/build/src/constants.js +0 -24
  175. package/build/src/conventional-commits.d.ts +0 -53
  176. package/build/src/conventional-commits.js +0 -167
  177. package/build/src/github-release.d.ts +0 -34
  178. package/build/src/github-release.js +0 -92
  179. package/build/src/graphql-to-commits.d.ts +0 -60
  180. package/build/src/graphql-to-commits.js +0 -112
  181. package/build/src/index.d.ts +0 -95
  182. package/build/src/index.js +0 -32
  183. package/build/src/plugins/index.d.ts +0 -5
  184. package/build/src/plugins/plugin.d.ts +0 -21
  185. package/build/src/release-pr.d.ts +0 -101
  186. package/build/src/release-pr.js +0 -461
  187. package/build/src/releasers/dart.d.ts +0 -9
  188. package/build/src/releasers/dart.js +0 -65
  189. package/build/src/releasers/elixir.d.ts +0 -5
  190. package/build/src/releasers/go-yoshi.d.ts +0 -10
  191. package/build/src/releasers/go-yoshi.js +0 -162
  192. package/build/src/releasers/go.d.ts +0 -6
  193. package/build/src/releasers/helm.d.ts +0 -9
  194. package/build/src/releasers/helm.js +0 -66
  195. package/build/src/releasers/index.d.ts +0 -7
  196. package/build/src/releasers/index.js +0 -76
  197. package/build/src/releasers/java/bump_type.d.ts +0 -4
  198. package/build/src/releasers/java/bump_type.js +0 -38
  199. package/build/src/releasers/java/stability.d.ts +0 -5
  200. package/build/src/releasers/java/stability.js +0 -37
  201. package/build/src/releasers/java/version.d.ts +0 -13
  202. package/build/src/releasers/java/version.js +0 -112
  203. package/build/src/releasers/java-backport.d.ts +0 -9
  204. package/build/src/releasers/java-backport.js +0 -43
  205. package/build/src/releasers/java-bom.d.ts +0 -16
  206. package/build/src/releasers/java-bom.js +0 -83
  207. package/build/src/releasers/java-lts.d.ts +0 -9
  208. package/build/src/releasers/java-lts.js +0 -47
  209. package/build/src/releasers/java-yoshi.d.ts +0 -28
  210. package/build/src/releasers/java-yoshi.js +0 -304
  211. package/build/src/releasers/krm-blueprint.d.ts +0 -6
  212. package/build/src/releasers/node.d.ts +0 -10
  213. package/build/src/releasers/node.js +0 -84
  214. package/build/src/releasers/ocaml.d.ts +0 -5
  215. package/build/src/releasers/php-yoshi.d.ts +0 -5
  216. package/build/src/releasers/php-yoshi.js +0 -191
  217. package/build/src/releasers/php.d.ts +0 -7
  218. package/build/src/releasers/python.d.ts +0 -11
  219. package/build/src/releasers/python.js +0 -127
  220. package/build/src/releasers/ruby-yoshi.d.ts +0 -5
  221. package/build/src/releasers/ruby-yoshi.js +0 -142
  222. package/build/src/releasers/ruby.d.ts +0 -11
  223. package/build/src/releasers/rust.d.ts +0 -30
  224. package/build/src/releasers/rust.js +0 -163
  225. package/build/src/releasers/simple.d.ts +0 -5
  226. package/build/src/releasers/terraform-module.d.ts +0 -6
  227. package/build/src/updaters/elixir-mix-exs.d.ts +0 -13
  228. package/build/src/updaters/java/google-utils.d.ts +0 -13
  229. package/build/src/updaters/java/java_update.d.ts +0 -13
  230. package/build/src/updaters/java/pom-xml.d.ts +0 -3
  231. package/build/src/updaters/java/readme.d.ts +0 -3
  232. package/build/src/updaters/java/readme.js.map +0 -1
  233. package/build/src/updaters/package-json.d.ts +0 -16
  234. package/build/src/updaters/package-lock-json.d.ts +0 -7
  235. package/build/src/updaters/php-client-version.d.ts +0 -13
  236. package/build/src/updaters/php-manifest.d.ts +0 -13
  237. package/build/src/updaters/pubspec-yaml.d.ts +0 -13
  238. package/build/src/updaters/root-composer-update-package.d.ts +0 -13
  239. package/build/src/updaters/root-composer-update-package.js +0 -45
  240. package/build/src/updaters/root-composer-update-packages.d.ts +0 -13
  241. package/build/src/updaters/samples-package-json.d.ts +0 -13
  242. package/build/src/updaters/update.d.ts +0 -20
  243. package/build/src/updaters/version-rb.d.ts +0 -13
  244. package/build/src/updaters/version-txt.d.ts +0 -12
  245. package/build/src/updaters/version.d.ts +0 -13
  246. package/build/src/updaters/version.js +0 -31
  247. package/build/src/util/checkpoint.d.ts +0 -6
  248. package/build/src/util/checkpoint.js +0 -33
  249. package/build/src/util/release-notes.d.ts +0 -7
  250. package/build/src/util/release-notes.js +0 -34
  251. package/build/src/util/to-conventional-changelog-format.d.ts +0 -2
@@ -1,220 +1,121 @@
1
- import { Changes } from 'code-suggester';
1
+ import { PullRequest } from './pull-request';
2
+ import { Commit } from './commit';
2
3
  import { Octokit } from '@octokit/rest';
3
4
  import { request } from '@octokit/request';
4
- import { PromiseValue } from 'type-fest';
5
+ export declare const GH_API_URL = "https://api.github.com";
6
+ export declare const GH_GRAPHQL_URL = "https://api.github.com";
5
7
  declare type OctokitType = InstanceType<typeof Octokit>;
6
- declare type PullsListResponseItems = PromiseValue<ReturnType<InstanceType<typeof Octokit>['pulls']['list']>>['data'];
7
- export declare type ReleaseCreateResponse = {
8
- name: string;
9
- tag_name: string;
10
- draft: boolean;
11
- html_url: string;
12
- upload_url: string;
13
- body: string;
14
- };
8
+ import { Repository } from './repository';
9
+ import { ReleasePullRequest } from './release-pull-request';
10
+ import { Update } from './update';
11
+ import { Release } from './release';
15
12
  declare type RequestBuilderType = typeof request;
16
13
  declare type DefaultFunctionType = RequestBuilderType['defaults'];
17
14
  declare type RequestFunctionType = ReturnType<DefaultFunctionType>;
18
- declare type MergedPullRequestFilter = (filter: MergedGitHubPR) => boolean;
19
- declare type CommitFilter = (commit: Commit, pullRequest: MergedGitHubPR | undefined) => boolean;
20
- import { Commit, PREdge } from './graphql-to-commits';
21
- import { Update } from './updaters/update';
22
- import { GitHubConstructorOptions } from '.';
23
15
  export interface OctokitAPIs {
24
16
  graphql: Function;
25
17
  request: RequestFunctionType;
26
18
  octokit: OctokitType;
27
19
  }
28
- export interface GitHubTag {
29
- name: string;
30
- sha: string;
31
- version: string;
20
+ export interface GitHubOptions {
21
+ repository: Repository;
22
+ octokitAPIs: OctokitAPIs;
23
+ }
24
+ interface GitHubCreateOptions {
25
+ owner: string;
26
+ repo: string;
27
+ defaultBranch?: string;
28
+ apiUrl?: string;
29
+ graphqlUrl?: string;
30
+ octokitAPIs?: OctokitAPIs;
31
+ token?: string;
32
32
  }
33
33
  export interface GitHubFileContents {
34
34
  sha: string;
35
35
  content: string;
36
36
  parsedContent: string;
37
37
  }
38
- export interface GitHubPR {
39
- branch: string;
40
- title: string;
41
- body: string;
42
- message: string;
43
- updates: Update[];
44
- labels: string[];
45
- changes?: Changes;
46
- }
47
- export interface MergedGitHubPR {
38
+ declare type CommitFilter = (commit: Commit) => boolean;
39
+ export interface GitHubRelease {
40
+ name?: string;
41
+ tagName: string;
48
42
  sha: string;
49
- number: number;
50
- baseRefName: string;
51
- headRefName: string;
52
- labels: string[];
53
- title: string;
54
- body: string;
55
- }
56
- interface CommitWithPullRequest {
57
- commit: Commit;
58
- pullRequest?: MergedGitHubPR;
59
- }
60
- export interface MergedGitHubPRWithFiles extends MergedGitHubPR {
61
- files: string[];
62
- }
63
- export interface Repository<T> {
64
- repository: T;
65
- }
66
- interface Nodes<T> {
67
- nodes: T[];
68
- }
69
- export interface PageInfo {
70
- endCursor: string;
71
- hasNextPage: boolean;
72
- }
73
- interface PullRequestNode {
74
- title: string;
75
- body: string;
76
- number: number;
77
- mergeCommit: {
78
- oid: string;
79
- };
80
- files: {
81
- pageInfo: PageInfo;
82
- } & Nodes<{
83
- path: string;
84
- }>;
85
- labels: Nodes<{
86
- name: string;
87
- }>;
88
- }
89
- export interface PullRequests {
90
- pullRequests: Nodes<PullRequestNode>;
43
+ notes?: string;
44
+ url: string;
45
+ draft?: boolean;
91
46
  }
92
47
  export declare class GitHub {
93
- defaultBranch?: string;
94
- octokit: OctokitType;
95
- request: RequestFunctionType;
96
- graphql: Function;
97
- token: string | undefined;
98
- owner: string;
99
- repo: string;
100
- apiUrl: string;
101
- graphqlUrl: string;
102
- fork: boolean;
103
- repositoryDefaultBranch?: string;
104
- constructor(options: GitHubConstructorOptions);
105
- private makeGraphqlRequest;
106
- private graphqlRequest;
107
- private decoratePaginateOpts;
108
- /**
109
- * Returns the list of commits since a given SHA on the target branch
110
- *
111
- * @param {string} sha SHA of the base commit or undefined for all commits
112
- * @param {string} path If provided, limit to commits that affect the provided path
113
- * @param {number} per_page Pagination option. Defaults to 100
114
- * @returns {Commit[]} List of commits
115
- * @throws {GitHubAPIError} on an API error
116
- */
117
- commitsSinceShaRest: (sha?: string | undefined, path?: string | undefined, per_page?: any) => Promise<Commit[]>;
48
+ readonly repository: Repository;
49
+ private octokit;
50
+ private request;
51
+ private graphql;
52
+ private constructor();
118
53
  /**
119
- * Returns the list of commits since a given SHA on the target branch
54
+ * Build a new GitHub client with auto-detected default branch.
120
55
  *
121
- * Note: Commit.files only for commits from PRs.
122
- *
123
- * @param {string|undefined} sha SHA of the base commit or undefined for all commits
124
- * @param {number} perPage Pagination option. Defaults to 100
125
- * @param {boolean} labels Whether or not to return labels. Defaults to false
126
- * @param {string|null} path If provided, limit to commits that affect the provided path
127
- * @returns {Commit[]} List of commits
128
- * @throws {GitHubAPIError} on an API error
56
+ * @param {GitHubCreateOptions} options Configuration options
57
+ * @param {string} options.owner The repository owner.
58
+ * @param {string} options.repo The repository name.
59
+ * @param {string} options.defaultBranch Optional. The repository's default branch.
60
+ * Defaults to the value fetched via the API.
61
+ * @param {string} options.apiUrl Optional. The base url of the GitHub API.
62
+ * @param {string} options.graphqlUrl Optional. The base url of the GraphQL API.
63
+ * @param {OctokitAPISs} options.octokitAPIs Optional. Override the internal
64
+ * client instances with a pre-authenticated instance.
65
+ * @param {string} token Optional. A GitHub API token used for authentication.
129
66
  */
130
- commitsSinceSha(sha: string | undefined, perPage?: number, labels?: boolean, path?: string | null): Promise<Commit[]>;
131
- private commitsWithFiles;
132
- private commitsWithLabels;
67
+ static create(options: GitHubCreateOptions): Promise<GitHub>;
133
68
  /**
134
- * Return the pull request files
69
+ * Returns the default branch for a given repository.
135
70
  *
136
- * @param {number} num Pull request number
137
- * @param {string} cursor Pagination cursor
138
- * @param {number} maxFilesChanged Number of files to return per page
139
- * @return {PREdge}
140
- * @throws {GitHubAPIError} on an API error
71
+ * @param {string} owner The GitHub repository owner
72
+ * @param {string} repo The GitHub repository name
73
+ * @param {OctokitType} octokit An authenticated octokit instance
74
+ * @returns {string} Name of the default branch
141
75
  */
142
- pullRequestFiles(num: number, cursor: string, maxFilesChanged?: number): Promise<PREdge>;
76
+ static defaultBranch(owner: string, repo: string, octokit: OctokitType): Promise<string>;
143
77
  /**
144
- * Find the SHA of the commit at the provided tag.
145
- *
146
- * @param {string} name Tag name
147
- * @returns {string} The SHA of the commit
148
- * @throws {GitHubAPIError} on an API error
149
- */
150
- getTagSha: (name: string) => Promise<string>;
151
- /**
152
- * Find the "last" merged PR given a headBranch. "last" here means
153
- * the most recently created. Includes all associated files.
154
- *
155
- * @param {string} headBranch - e.g. "release-please/branches/main"
156
- * @returns {MergedGitHubPRWithFiles} - if found, otherwise undefined.
157
- * @throws {GitHubAPIError} on an API error
158
- */
159
- lastMergedPRByHeadBranch(headBranch: string): Promise<MergedGitHubPRWithFiles | undefined>;
160
- /**
161
- * If we can't find a release branch (a common cause of this, as an example
162
- * is that we might be dealing with the first relese), use the last semver
163
- * tag that's available on the repository:
164
- *
165
- * TODO: it would be good to not need to maintain this logic, and the
166
- * logic that introspects version based on the prior release PR.
167
- *
168
- * @param {string} prefix If provided, filter the tags with this prefix
169
- * @param {boolean} preRelease Whether or not to include pre-releases
170
- * @return {GitHubTag|undefined}
171
- * @throws {GitHubAPIError} on an API error *
172
- */
173
- latestTagFallback(prefix?: string, preRelease?: boolean): Promise<GitHubTag | undefined>;
174
- private allTags;
175
- private mergeCommitsGraphQL;
176
- /**
177
- * Search through commit history to find the latest commit that matches to
178
- * provided filter.
78
+ * Returns the list of commits to the default branch after the provided filter
79
+ * query has been satified.
179
80
  *
180
- * @param {CommitFilter} filter - Callback function that returns whether a
81
+ * @param {string} targetBranch Target branch of commit
82
+ * @param {CommitFilter} filter Callback function that returns whether a
181
83
  * commit/pull request matches certain criteria
182
- * @param {number} maxResults - Limit the number of results searched.
84
+ * @param {number} maxResults Limit the number of results searched.
183
85
  * Defaults to unlimited.
184
- * @returns {CommitWithPullRequest}
86
+ * @returns {Commit[]} List of commits to current branch
185
87
  * @throws {GitHubAPIError} on an API error
186
88
  */
187
- findMergeCommit(filter: CommitFilter, maxResults?: number): Promise<CommitWithPullRequest | undefined>;
89
+ commitsSince(targetBranch: string, filter: CommitFilter, maxResults?: number): Promise<Commit[]>;
188
90
  /**
189
91
  * Iterate through commit history with a max number of results scanned.
190
92
  *
191
- * @param maxResults {number} maxResults - Limit the number of results searched.
93
+ * @param {string} targetBranch target branch of commit
94
+ * @param {number} maxResults maxResults - Limit the number of results searched.
192
95
  * Defaults to unlimited.
193
- * @yields {CommitWithPullRequest}
96
+ * @yields {Commit}
194
97
  * @throws {GitHubAPIError} on an API error
195
98
  */
196
- mergeCommitIterator(maxResults?: number): AsyncGenerator<CommitWithPullRequest, void, unknown>;
99
+ mergeCommitIterator(targetBranch: string, maxResults?: number): AsyncGenerator<Commit, void, unknown>;
100
+ private mergeCommitsGraphQL;
197
101
  /**
198
- * Iterate through merged pull requests with a max number of results scanned.
102
+ * Get the list of file paths modified in a given commit.
199
103
  *
200
- * @param maxResults {number} maxResults - Limit the number of results searched.
201
- * Defaults to unlimited.
202
- * @yields {MergedGitHubPR}
104
+ * @param {string} sha The commit SHA
105
+ * @returns {string[]} File paths
203
106
  * @throws {GitHubAPIError} on an API error
204
107
  */
205
- mergedPullRequestIterator(branch: string, maxResults?: number): AsyncGenerator<MergedGitHubPR, void, unknown>;
108
+ getCommitFiles: (sha: string) => Promise<string[]>;
109
+ private graphqlRequest;
206
110
  /**
207
- * Returns the list of commits to the default branch after the provided filter
208
- * query has been satified.
111
+ * Iterate through merged pull requests with a max number of results scanned.
209
112
  *
210
- * @param {CommitFilter} filter - Callback function that returns whether a
211
- * commit/pull request matches certain criteria
212
- * @param {number} maxResults - Limit the number of results searched.
113
+ * @param {number} maxResults maxResults - Limit the number of results searched.
213
114
  * Defaults to unlimited.
214
- * @returns {Commit[]} - List of commits to current branch
115
+ * @yields {PullRequest}
215
116
  * @throws {GitHubAPIError} on an API error
216
117
  */
217
- commitsSince(filter: CommitFilter, maxResults?: number): Promise<Commit[]>;
118
+ pullRequestIterator(targetBranch: string, status?: 'OPEN' | 'CLOSED' | 'MERGED', maxResults?: number): AsyncGenerator<PullRequest, void, unknown>;
218
119
  /**
219
120
  * Return a list of merged pull requests. The list is not guaranteed to be sorted
220
121
  * by merged_at, but is generally most recent first.
@@ -223,601 +124,28 @@ export declare class GitHub {
223
124
  * the configured default branch.
224
125
  * @param {number} page - Page of results. Defaults to 1.
225
126
  * @param {number} perPage - Number of results per page. Defaults to 100.
226
- * @returns {MergedGitHubPR[]} - List of merged pull requests
127
+ * @returns {PullRequestHistory | null} - List of merged pull requests
227
128
  * @throws {GitHubAPIError} on an API error
228
129
  */
229
- findMergedPullRequests: (targetBranch?: string | undefined, page?: any, perPage?: any) => Promise<MergedGitHubPR[]>;
130
+ private pullRequestsGraphQL;
230
131
  /**
231
- * Helper to find the first merged pull request that matches the
232
- * given criteria. The helper will paginate over all pull requests
233
- * merged into the specified target branch.
234
- *
235
- * @param {string} targetBranch - Base branch of the pull request
236
- * @param {MergedPullRequestFilter} filter - Callback function that
237
- * returns whether a pull request matches certain criteria
238
- * @param {number} maxResults - Limit the number of results searched.
239
- * Defaults to unlimited.
240
- * @returns {MergedGitHubPR | undefined} - Returns the first matching
241
- * pull request, or `undefined` if no matching pull request found.
242
- * @throws {GitHubAPIError} on an API error
243
- */
244
- findMergedPullRequest(targetBranch: string, filter: MergedPullRequestFilter, maxResults?: number): Promise<MergedGitHubPR | undefined>;
245
- /**
246
- * Find the last merged pull request that targeted the default
247
- * branch and looks like a release PR.
248
- *
249
- * Note: The default matcher will rule out pre-releases.
132
+ * Iterate through merged pull requests with a max number of results scanned.
250
133
  *
251
- * @param {string[]} labels - If provided, ensure that the pull
252
- * request has all of the specified labels
253
- * @param {string|undefined} branchPrefix - If provided, limit
254
- * release pull requests that contain the specified component
255
- * @param {boolean} preRelease - Whether to include pre-release
256
- * versions in the response. Defaults to true.
257
- * @param {number} maxResults - Limit the number of results searched.
134
+ * @param {number} maxResults maxResults - Limit the number of results searched.
258
135
  * Defaults to unlimited.
259
- * @returns {MergedGitHubPR|undefined}
136
+ * @yields {GitHubRelease}
260
137
  * @throws {GitHubAPIError} on an API error
261
138
  */
262
- findMergedReleasePR(labels: string[], branchPrefix?: string | undefined, preRelease?: boolean, maxResults?: number): Promise<MergedGitHubPR | undefined>;
263
- private hasAllLabels;
139
+ releaseIterator(maxResults?: number): AsyncGenerator<GitHubRelease, void, unknown>;
140
+ private releaseGraphQL;
264
141
  /**
265
- * Find open pull requests with matching labels.
266
- *
267
- * @param {string[]} labels List of labels to match
268
- * @param {number} perPage Optional. Defaults to 100
269
- * @return {PullsListResponseItems} Pull requests
270
- * @throws {GitHubAPIError} on an API error
271
- */
272
- findOpenReleasePRs(labels: string[], perPage?: number): Promise<PullsListResponseItems>;
273
- /**
274
- * Add labels to an issue or pull request
275
- *
276
- * @param {string[]} labels List of labels to add
277
- * @param {number} pr Issue or pull request number
278
- * @return {boolean} Whether or not the labels were added
279
- * @throws {GitHubAPIError} on an API error
280
- */
281
- addLabels(labels: string[], pr: number): Promise<boolean>;
282
- /**
283
- * Find an existing release pull request with a matching title and labels
142
+ * Fetch the contents of a file from the configured branch
284
143
  *
285
- * @param {string} title Substring to match against the issue title
286
- * @param {string[]} labels List of labels to match the issues
287
- * @return {IssuesListResponseItem|undefined}
288
- * @throws {AuthError} if the user is not authenticated to make this request
144
+ * @param {string} path The path to the file in the repository
145
+ * @returns {GitHubFileContents}
289
146
  * @throws {GitHubAPIError} on other API errors
290
147
  */
291
- findExistingReleaseIssue: (title: string, labels: string[]) => Promise<{
292
- id: number;
293
- node_id: string;
294
- url: string;
295
- repository_url: string;
296
- labels_url: string;
297
- comments_url: string;
298
- events_url: string;
299
- html_url: string;
300
- number: number;
301
- state: string;
302
- title: string;
303
- body?: string | null | undefined;
304
- user: {
305
- name?: string | null | undefined;
306
- email?: string | null | undefined;
307
- login: string;
308
- id: number;
309
- node_id: string;
310
- avatar_url: string;
311
- gravatar_id: string | null;
312
- url: string;
313
- html_url: string;
314
- followers_url: string;
315
- following_url: string;
316
- gists_url: string;
317
- starred_url: string;
318
- subscriptions_url: string;
319
- organizations_url: string;
320
- repos_url: string;
321
- events_url: string;
322
- received_events_url: string;
323
- type: string;
324
- site_admin: boolean;
325
- starred_at?: string | undefined;
326
- } | null;
327
- labels: (string | {
328
- id?: number | undefined;
329
- node_id?: string | undefined;
330
- url?: string | undefined;
331
- name?: string | undefined;
332
- description?: string | null | undefined;
333
- color?: string | null | undefined;
334
- default?: boolean | undefined;
335
- })[];
336
- assignee: {
337
- name?: string | null | undefined;
338
- email?: string | null | undefined;
339
- login: string;
340
- id: number;
341
- node_id: string;
342
- avatar_url: string;
343
- gravatar_id: string | null;
344
- url: string;
345
- html_url: string;
346
- followers_url: string;
347
- following_url: string;
348
- gists_url: string;
349
- starred_url: string;
350
- subscriptions_url: string;
351
- organizations_url: string;
352
- repos_url: string;
353
- events_url: string;
354
- received_events_url: string;
355
- type: string;
356
- site_admin: boolean;
357
- starred_at?: string | undefined;
358
- } | null;
359
- assignees?: {
360
- name?: string | null | undefined;
361
- email?: string | null | undefined;
362
- login: string;
363
- id: number;
364
- node_id: string;
365
- avatar_url: string;
366
- gravatar_id: string | null;
367
- url: string;
368
- html_url: string;
369
- followers_url: string;
370
- following_url: string;
371
- gists_url: string;
372
- starred_url: string;
373
- subscriptions_url: string;
374
- organizations_url: string;
375
- repos_url: string;
376
- events_url: string;
377
- received_events_url: string;
378
- type: string;
379
- site_admin: boolean;
380
- starred_at?: string | undefined;
381
- }[] | null | undefined;
382
- milestone: {
383
- url: string;
384
- html_url: string;
385
- labels_url: string;
386
- id: number;
387
- node_id: string;
388
- number: number;
389
- state: ShadowRootMode;
390
- title: string;
391
- description: string | null;
392
- creator: {
393
- name?: string | null | undefined;
394
- email?: string | null | undefined;
395
- login: string;
396
- id: number;
397
- node_id: string;
398
- avatar_url: string;
399
- gravatar_id: string | null;
400
- url: string;
401
- html_url: string;
402
- followers_url: string;
403
- following_url: string;
404
- gists_url: string;
405
- starred_url: string;
406
- subscriptions_url: string;
407
- organizations_url: string;
408
- repos_url: string;
409
- events_url: string;
410
- received_events_url: string;
411
- type: string;
412
- site_admin: boolean;
413
- starred_at?: string | undefined;
414
- } | null;
415
- open_issues: number;
416
- closed_issues: number;
417
- created_at: string;
418
- updated_at: string;
419
- closed_at: string | null;
420
- due_on: string | null;
421
- } | null;
422
- locked: boolean;
423
- active_lock_reason?: string | null | undefined;
424
- comments: number;
425
- pull_request?: {
426
- merged_at?: string | null | undefined;
427
- diff_url: string | null;
428
- html_url: string | null;
429
- patch_url: string | null;
430
- url: string | null;
431
- } | undefined;
432
- closed_at: string | null;
433
- created_at: string;
434
- updated_at: string;
435
- closed_by?: {
436
- name?: string | null | undefined;
437
- email?: string | null | undefined;
438
- login: string;
439
- id: number;
440
- node_id: string;
441
- avatar_url: string;
442
- gravatar_id: string | null;
443
- url: string;
444
- html_url: string;
445
- followers_url: string;
446
- following_url: string;
447
- gists_url: string;
448
- starred_url: string;
449
- subscriptions_url: string;
450
- organizations_url: string;
451
- repos_url: string;
452
- events_url: string;
453
- received_events_url: string;
454
- type: string;
455
- site_admin: boolean;
456
- starred_at?: string | undefined;
457
- } | null | undefined;
458
- body_html?: string | undefined;
459
- body_text?: string | undefined;
460
- timeline_url?: string | undefined;
461
- repository?: {
462
- id: number;
463
- node_id: string;
464
- name: string;
465
- full_name: string;
466
- license: {
467
- key: string;
468
- name: string;
469
- url: string | null;
470
- spdx_id: string | null;
471
- node_id: string;
472
- html_url?: string | undefined;
473
- } | null;
474
- organization?: {
475
- name?: string | null | undefined;
476
- email?: string | null | undefined;
477
- login: string;
478
- id: number;
479
- node_id: string;
480
- avatar_url: string;
481
- gravatar_id: string | null;
482
- url: string;
483
- html_url: string;
484
- followers_url: string;
485
- following_url: string;
486
- gists_url: string;
487
- starred_url: string;
488
- subscriptions_url: string;
489
- organizations_url: string;
490
- repos_url: string;
491
- events_url: string;
492
- received_events_url: string;
493
- type: string;
494
- site_admin: boolean;
495
- starred_at?: string | undefined;
496
- } | null | undefined;
497
- forks: number;
498
- permissions?: {
499
- admin: boolean;
500
- pull: boolean;
501
- triage?: boolean | undefined;
502
- push: boolean;
503
- maintain?: boolean | undefined;
504
- } | undefined;
505
- owner: {
506
- name?: string | null | undefined;
507
- email?: string | null | undefined;
508
- login: string;
509
- id: number;
510
- node_id: string;
511
- avatar_url: string;
512
- gravatar_id: string | null;
513
- url: string;
514
- html_url: string;
515
- followers_url: string;
516
- following_url: string;
517
- gists_url: string;
518
- starred_url: string;
519
- subscriptions_url: string;
520
- organizations_url: string;
521
- repos_url: string;
522
- events_url: string;
523
- received_events_url: string;
524
- type: string;
525
- site_admin: boolean;
526
- starred_at?: string | undefined;
527
- };
528
- private: boolean;
529
- html_url: string;
530
- description: string | null;
531
- fork: boolean;
532
- url: string;
533
- archive_url: string;
534
- assignees_url: string;
535
- blobs_url: string;
536
- branches_url: string;
537
- collaborators_url: string;
538
- comments_url: string;
539
- commits_url: string;
540
- compare_url: string;
541
- contents_url: string;
542
- contributors_url: string;
543
- deployments_url: string;
544
- downloads_url: string;
545
- events_url: string;
546
- forks_url: string;
547
- git_commits_url: string;
548
- git_refs_url: string;
549
- git_tags_url: string;
550
- git_url: string;
551
- issue_comment_url: string;
552
- issue_events_url: string;
553
- issues_url: string;
554
- keys_url: string;
555
- labels_url: string;
556
- languages_url: string;
557
- merges_url: string;
558
- milestones_url: string;
559
- notifications_url: string;
560
- pulls_url: string;
561
- releases_url: string;
562
- ssh_url: string;
563
- stargazers_url: string;
564
- statuses_url: string;
565
- subscribers_url: string;
566
- subscription_url: string;
567
- tags_url: string;
568
- teams_url: string;
569
- trees_url: string;
570
- clone_url: string;
571
- mirror_url: string | null;
572
- hooks_url: string;
573
- svn_url: string;
574
- homepage: string | null;
575
- language: string | null;
576
- forks_count: number;
577
- stargazers_count: number;
578
- watchers_count: number;
579
- size: number;
580
- default_branch: string;
581
- open_issues_count: number;
582
- is_template?: boolean | undefined;
583
- topics?: string[] | undefined;
584
- has_issues: boolean;
585
- has_projects: boolean;
586
- has_wiki: boolean;
587
- has_pages: boolean;
588
- has_downloads: boolean;
589
- archived: boolean;
590
- disabled: boolean;
591
- visibility?: string | undefined;
592
- pushed_at: string | null;
593
- created_at: string | null;
594
- updated_at: string | null;
595
- allow_rebase_merge?: boolean | undefined;
596
- template_repository?: {
597
- id?: number | undefined;
598
- node_id?: string | undefined;
599
- name?: string | undefined;
600
- full_name?: string | undefined;
601
- owner?: {
602
- login?: string | undefined;
603
- id?: number | undefined;
604
- node_id?: string | undefined;
605
- avatar_url?: string | undefined;
606
- gravatar_id?: string | undefined;
607
- url?: string | undefined;
608
- html_url?: string | undefined;
609
- followers_url?: string | undefined;
610
- following_url?: string | undefined;
611
- gists_url?: string | undefined;
612
- starred_url?: string | undefined;
613
- subscriptions_url?: string | undefined;
614
- organizations_url?: string | undefined;
615
- repos_url?: string | undefined;
616
- events_url?: string | undefined;
617
- received_events_url?: string | undefined;
618
- type?: string | undefined;
619
- site_admin?: boolean | undefined;
620
- } | undefined;
621
- private?: boolean | undefined;
622
- html_url?: string | undefined;
623
- description?: string | undefined;
624
- fork?: boolean | undefined;
625
- url?: string | undefined;
626
- archive_url?: string | undefined;
627
- assignees_url?: string | undefined;
628
- blobs_url?: string | undefined;
629
- branches_url?: string | undefined;
630
- collaborators_url?: string | undefined;
631
- comments_url?: string | undefined;
632
- commits_url?: string | undefined;
633
- compare_url?: string | undefined;
634
- contents_url?: string | undefined;
635
- contributors_url?: string | undefined;
636
- deployments_url?: string | undefined;
637
- downloads_url?: string | undefined;
638
- events_url?: string | undefined;
639
- forks_url?: string | undefined;
640
- git_commits_url?: string | undefined;
641
- git_refs_url?: string | undefined;
642
- git_tags_url?: string | undefined;
643
- git_url?: string | undefined;
644
- issue_comment_url?: string | undefined;
645
- issue_events_url?: string | undefined;
646
- issues_url?: string | undefined;
647
- keys_url?: string | undefined;
648
- labels_url?: string | undefined;
649
- languages_url?: string | undefined;
650
- merges_url?: string | undefined;
651
- milestones_url?: string | undefined;
652
- notifications_url?: string | undefined;
653
- pulls_url?: string | undefined;
654
- releases_url?: string | undefined;
655
- ssh_url?: string | undefined;
656
- stargazers_url?: string | undefined;
657
- statuses_url?: string | undefined;
658
- subscribers_url?: string | undefined;
659
- subscription_url?: string | undefined;
660
- tags_url?: string | undefined;
661
- teams_url?: string | undefined;
662
- trees_url?: string | undefined;
663
- clone_url?: string | undefined;
664
- mirror_url?: string | undefined;
665
- hooks_url?: string | undefined;
666
- svn_url?: string | undefined;
667
- homepage?: string | undefined;
668
- language?: string | undefined;
669
- forks_count?: number | undefined;
670
- stargazers_count?: number | undefined;
671
- watchers_count?: number | undefined;
672
- size?: number | undefined;
673
- default_branch?: string | undefined;
674
- open_issues_count?: number | undefined;
675
- is_template?: boolean | undefined;
676
- topics?: string[] | undefined;
677
- has_issues?: boolean | undefined;
678
- has_projects?: boolean | undefined;
679
- has_wiki?: boolean | undefined;
680
- has_pages?: boolean | undefined;
681
- has_downloads?: boolean | undefined;
682
- archived?: boolean | undefined;
683
- disabled?: boolean | undefined;
684
- visibility?: string | undefined;
685
- pushed_at?: string | undefined;
686
- created_at?: string | undefined;
687
- updated_at?: string | undefined;
688
- permissions?: {
689
- admin?: boolean | undefined;
690
- maintain?: boolean | undefined;
691
- push?: boolean | undefined;
692
- triage?: boolean | undefined;
693
- pull?: boolean | undefined;
694
- } | undefined;
695
- allow_rebase_merge?: boolean | undefined;
696
- temp_clone_token?: string | undefined;
697
- allow_squash_merge?: boolean | undefined;
698
- allow_auto_merge?: boolean | undefined;
699
- delete_branch_on_merge?: boolean | undefined;
700
- allow_merge_commit?: boolean | undefined;
701
- subscribers_count?: number | undefined;
702
- network_count?: number | undefined;
703
- } | null | undefined;
704
- temp_clone_token?: string | undefined;
705
- allow_squash_merge?: boolean | undefined;
706
- allow_auto_merge?: boolean | undefined;
707
- delete_branch_on_merge?: boolean | undefined;
708
- allow_merge_commit?: boolean | undefined;
709
- allow_forking?: boolean | undefined;
710
- subscribers_count?: number | undefined;
711
- network_count?: number | undefined;
712
- open_issues: number;
713
- watchers: number;
714
- master_branch?: string | undefined;
715
- starred_at?: string | undefined;
716
- } | undefined;
717
- performed_via_github_app?: {
718
- id: number;
719
- slug?: string | undefined;
720
- node_id: string;
721
- owner: {
722
- name?: string | null | undefined;
723
- email?: string | null | undefined;
724
- login: string;
725
- id: number;
726
- node_id: string;
727
- avatar_url: string;
728
- gravatar_id: string | null;
729
- url: string;
730
- html_url: string;
731
- followers_url: string;
732
- following_url: string;
733
- gists_url: string;
734
- starred_url: string;
735
- subscriptions_url: string;
736
- organizations_url: string;
737
- repos_url: string;
738
- events_url: string;
739
- received_events_url: string;
740
- type: string;
741
- site_admin: boolean;
742
- starred_at?: string | undefined;
743
- } | null;
744
- name: string;
745
- description: string | null;
746
- external_url: string;
747
- html_url: string;
748
- created_at: string;
749
- updated_at: string;
750
- permissions: {
751
- issues?: string | undefined;
752
- checks?: string | undefined;
753
- metadata?: string | undefined;
754
- contents?: string | undefined;
755
- deployments?: string | undefined;
756
- } & {
757
- [key: string]: string;
758
- };
759
- events: string[];
760
- installations_count?: number | undefined;
761
- client_id?: string | undefined;
762
- client_secret?: string | undefined;
763
- webhook_secret?: string | null | undefined;
764
- pem?: string | undefined;
765
- } | null | undefined;
766
- author_association: "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "MEMBER" | "NONE" | "OWNER";
767
- reactions?: {
768
- url: string;
769
- total_count: number;
770
- "+1": number;
771
- "-1": number;
772
- laugh: number;
773
- confused: number;
774
- heart: number;
775
- hooray: number;
776
- eyes: number;
777
- rocket: number;
778
- } | undefined;
779
- } | undefined>;
780
- /**
781
- * Open a pull request
782
- *
783
- * @param {GitHubPR} options The pull request options
784
- * @throws {GitHubAPIError} on an API error
785
- */
786
- openPR: (options: GitHubPR) => Promise<number | undefined>;
787
- /**
788
- * Given a set of proposed updates, build a changeset to suggest.
789
- *
790
- * @param {Update[]} updates The proposed updates
791
- * @param {string} defaultBranch The target branch
792
- * @return {Changes} The changeset to suggest.
793
- * @throws {GitHubAPIError} on an API error
794
- */
795
- getChangeSet(updates: Update[], defaultBranch: string): Promise<Changes>;
796
- private getBaseLabel;
797
- /**
798
- * Returns the branch we are targetting for releases. Defaults
799
- * to the repository's default/primary branch.
800
- *
801
- * @returns {string}
802
- * @throws {GitHubAPIError} on an API error
803
- */
804
- getDefaultBranch(): Promise<string>;
805
- /**
806
- * Returns the repository's default/primary branch.
807
- *
808
- * @returns {string}
809
- * @throws {GitHubAPIError} on an API error
810
- */
811
- getRepositoryDefaultBranch: () => Promise<string>;
812
- /**
813
- * Close a pull request
814
- *
815
- * @param {number} prNumber The pull request number
816
- * @returns {boolean} Whether the request was attempts
817
- * @throws {GitHubAPIError} on an API error
818
- */
819
- closePR: (prNumber: number) => Promise<boolean>;
820
- static fullyQualifyBranchRef(refName: string): string;
148
+ getFileContents(path: string): Promise<GitHubFileContents>;
821
149
  /**
822
150
  * Fetch the contents of a file with the Contents API
823
151
  *
@@ -835,15 +163,7 @@ export declare class GitHub {
835
163
  * @returns {GitHubFileContents}
836
164
  * @throws {GitHubAPIError} on other API errors
837
165
  */
838
- getFileContentsWithDataAPI(path: string, branch: string): Promise<GitHubFileContents>;
839
- /**
840
- * Fetch the contents of a file from the configured branch
841
- *
842
- * @param {string} path The path to the file in the repository
843
- * @returns {GitHubFileContents}
844
- * @throws {GitHubAPIError} on other API errors
845
- */
846
- getFileContents(path: string): Promise<GitHubFileContents>;
166
+ getFileContentsWithDataAPI: (path: string, branch: string) => Promise<GitHubFileContents>;
847
167
  /**
848
168
  * Fetch the contents of a file
849
169
  *
@@ -852,29 +172,20 @@ export declare class GitHub {
852
172
  * @returns {GitHubFileContents}
853
173
  * @throws {GitHubAPIError} on other API errors
854
174
  */
855
- getFileContentsOnBranch: (path: string, branch: string) => Promise<GitHubFileContents>;
175
+ getFileContentsOnBranch(path: string, branch: string): Promise<GitHubFileContents>;
176
+ getFileJson<T>(path: string, branch: string): Promise<T>;
856
177
  /**
857
- * Create a GitHub release
178
+ * Returns a list of paths to all files with a given name.
858
179
  *
859
- * @param {string} packageName name of the package
860
- * @param {string} tagName tag to create
861
- * @param {string} sha SHA of commit to tag at
862
- * @param {string} releaseNotes Notes to add to release
863
- * @param {boolean} draft Whether or not to create the release as a draft
864
- * @throws {DuplicateReleaseError} if the release tag already exists
865
- * @throws {GitHubAPIError} on other API errors
866
- */
867
- createRelease: (packageName: string, tagName: string, sha: string, releaseNotes: string, draft: boolean) => Promise<ReleaseCreateResponse>;
868
- /**
869
- * Remove labels from an issue or pull request
180
+ * If a prefix is specified, only return paths that match
181
+ * the provided prefix.
870
182
  *
871
- * @param {string[]} labels The names of the labels to remove
872
- * @param {number} prNumber The issue or pull request number
873
- * @return {boolean} Whether or not the request was attempted
183
+ * @param filename The name of the file to find
184
+ * @param prefix Optional path prefix used to filter results
185
+ * @returns {string[]} List of file paths
874
186
  * @throws {GitHubAPIError} on an API error
875
187
  */
876
- removeLabels: (labels: string[], prNumber: number) => Promise<boolean>;
877
- normalizePrefix(prefix: string): string;
188
+ findFilesByFilename(filename: string, prefix?: string): Promise<string[]>;
878
189
  /**
879
190
  * Returns a list of paths to all files with a given name.
880
191
  *
@@ -888,17 +199,46 @@ export declare class GitHub {
888
199
  */
889
200
  findFilesByFilenameAndRef: (filename: string, ref: string, prefix?: string | undefined) => Promise<string[]>;
890
201
  /**
891
- * Returns a list of paths to all files with a given name.
202
+ * Open a pull request
892
203
  *
893
- * If a prefix is specified, only return paths that match
894
- * the provided prefix.
204
+ * @param {ReleasePullRequest} releasePullRequest Pull request data to update
205
+ * @param {string} targetBranch The base branch of the pull request
206
+ * @param {GitHubPR} options The pull request options
207
+ * @throws {GitHubAPIError} on an API error
208
+ */
209
+ createReleasePullRequest(releasePullRequest: ReleasePullRequest, targetBranch: string, options?: {
210
+ signoffUser?: string;
211
+ fork?: boolean;
212
+ }): Promise<PullRequest>;
213
+ createPullRequest: (pullRequest: PullRequest, targetBranch: string, message: string, updates: Update[], options?: {
214
+ fork?: boolean | undefined;
215
+ draft?: boolean | undefined;
216
+ } | undefined) => Promise<PullRequest>;
217
+ /**
218
+ * Fetch a pull request given the pull number
219
+ * @param {number} number The pull request number
220
+ * @returns {PullRequest}
221
+ */
222
+ getPullRequest: (number: number) => Promise<PullRequest>;
223
+ /**
224
+ * Update a pull request's title and body.
225
+ * @param {number} number The pull request number
226
+ * @param {ReleasePullRequest} releasePullRequest Pull request data to update
227
+ * @param {}
228
+ */
229
+ updatePullRequest: (number: number, releasePullRequest: ReleasePullRequest, targetBranch: string, options?: {
230
+ signoffUser?: string | undefined;
231
+ fork?: boolean | undefined;
232
+ } | undefined) => Promise<PullRequest>;
233
+ /**
234
+ * Given a set of proposed updates, build a changeset to suggest.
895
235
  *
896
- * @param filename The name of the file to find
897
- * @param prefix Optional path prefix used to filter results
898
- * @returns {string[]} List of file paths
236
+ * @param {Update[]} updates The proposed updates
237
+ * @param {string} defaultBranch The target branch
238
+ * @return {Changes} The changeset to suggest.
899
239
  * @throws {GitHubAPIError} on an API error
900
240
  */
901
- findFilesByFilename(filename: string, prefix?: string): Promise<string[]>;
241
+ private getChangeSet;
902
242
  /**
903
243
  * Returns a list of paths to all files with a given file
904
244
  * extension.
@@ -928,6 +268,17 @@ export declare class GitHub {
928
268
  * @throws {GitHubAPIError} on an API error
929
269
  */
930
270
  findFilesByExtension(extension: string, prefix?: string): Promise<string[]>;
271
+ /**
272
+ * Create a GitHub release
273
+ *
274
+ * @param {Release} release Release parameters
275
+ * @param {boolean} draft Whether or not to create the release as a draft
276
+ * @throws {DuplicateReleaseError} if the release tag already exists
277
+ * @throws {GitHubAPIError} on other API errors
278
+ */
279
+ createRelease: (release: Release, options?: {
280
+ draft?: boolean | undefined;
281
+ } | undefined) => Promise<GitHubRelease>;
931
282
  /**
932
283
  * Makes a comment on a issue/pull request.
933
284
  *
@@ -935,102 +286,20 @@ export declare class GitHub {
935
286
  * @param {number} number - The issue or pull request number.
936
287
  * @throws {GitHubAPIError} on an API error
937
288
  */
938
- commentOnIssue: (comment: string, number: number) => Promise<{
939
- id: number;
940
- node_id: string;
941
- url: string;
942
- body?: string | undefined;
943
- body_text?: string | undefined;
944
- body_html?: string | undefined;
945
- html_url: string;
946
- user: {
947
- name?: string | null | undefined;
948
- email?: string | null | undefined;
949
- login: string;
950
- id: number;
951
- node_id: string;
952
- avatar_url: string;
953
- gravatar_id: string | null;
954
- url: string;
955
- html_url: string;
956
- followers_url: string;
957
- following_url: string;
958
- gists_url: string;
959
- starred_url: string;
960
- subscriptions_url: string;
961
- organizations_url: string;
962
- repos_url: string;
963
- events_url: string;
964
- received_events_url: string;
965
- type: string;
966
- site_admin: boolean;
967
- starred_at?: string | undefined;
968
- } | null;
969
- created_at: string;
970
- updated_at: string;
971
- issue_url: string;
972
- author_association: "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "MEMBER" | "NONE" | "OWNER";
973
- performed_via_github_app?: {
974
- id: number;
975
- slug?: string | undefined;
976
- node_id: string;
977
- owner: {
978
- name?: string | null | undefined;
979
- email?: string | null | undefined;
980
- login: string;
981
- id: number;
982
- node_id: string;
983
- avatar_url: string;
984
- gravatar_id: string | null;
985
- url: string;
986
- html_url: string;
987
- followers_url: string;
988
- following_url: string;
989
- gists_url: string;
990
- starred_url: string;
991
- subscriptions_url: string;
992
- organizations_url: string;
993
- repos_url: string;
994
- events_url: string;
995
- received_events_url: string;
996
- type: string;
997
- site_admin: boolean;
998
- starred_at?: string | undefined;
999
- } | null;
1000
- name: string;
1001
- description: string | null;
1002
- external_url: string;
1003
- html_url: string;
1004
- created_at: string;
1005
- updated_at: string;
1006
- permissions: {
1007
- issues?: string | undefined;
1008
- checks?: string | undefined;
1009
- metadata?: string | undefined;
1010
- contents?: string | undefined;
1011
- deployments?: string | undefined;
1012
- } & {
1013
- [key: string]: string;
1014
- };
1015
- events: string[];
1016
- installations_count?: number | undefined;
1017
- client_id?: string | undefined;
1018
- client_secret?: string | undefined;
1019
- webhook_secret?: string | null | undefined;
1020
- pem?: string | undefined;
1021
- } | null | undefined;
1022
- reactions?: {
1023
- url: string;
1024
- total_count: number;
1025
- "+1": number;
1026
- "-1": number;
1027
- laugh: number;
1028
- confused: number;
1029
- heart: number;
1030
- hooray: number;
1031
- eyes: number;
1032
- rocket: number;
1033
- } | undefined;
1034
- }>;
289
+ commentOnIssue: (comment: string, number: number) => Promise<string>;
290
+ /**
291
+ * Removes labels from an issue/pull request.
292
+ *
293
+ * @param {string[]} labels The labels to remove.
294
+ * @param {number} number The issue/pull request number.
295
+ */
296
+ removeIssueLabels: (labels: string[], number: number) => Promise<void>;
297
+ /**
298
+ * Adds label to an issue/pull request.
299
+ *
300
+ * @param {string[]} labels The labels to add.
301
+ * @param {number} number The issue/pull request number.
302
+ */
303
+ addIssueLabels: (labels: string[], number: number) => Promise<void>;
1035
304
  }
1036
305
  export {};