release-please 12.6.0 → 13.0.0-candidate.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/build/src/bin/release-please.d.ts +51 -13
  2. package/build/src/bin/release-please.js +409 -157
  3. package/build/src/bootstrapper.d.ts +12 -0
  4. package/build/src/bootstrapper.js +60 -0
  5. package/build/src/commit.d.ts +26 -0
  6. package/build/src/{util/to-conventional-changelog-format.js → commit.js} +97 -2
  7. package/build/src/errors/index.d.ts +0 -5
  8. package/build/src/errors/index.js +1 -10
  9. package/build/src/factory.d.ts +25 -37
  10. package/build/src/factory.js +159 -151
  11. package/build/src/github.d.ts +151 -884
  12. package/build/src/github.js +584 -1014
  13. package/build/src/manifest.d.ts +177 -48
  14. package/build/src/manifest.js +583 -487
  15. package/build/src/plugin.d.ts +20 -0
  16. package/build/src/{plugins/plugin.js → plugin.js} +10 -9
  17. package/build/src/plugins/cargo-workspace.d.ts +48 -18
  18. package/build/src/plugins/cargo-workspace.js +247 -328
  19. package/build/src/plugins/merge.d.ts +11 -0
  20. package/build/src/plugins/merge.js +83 -0
  21. package/build/src/plugins/node-workspace.d.ts +35 -17
  22. package/build/src/plugins/node-workspace.js +234 -271
  23. package/build/src/plugins/workspace.d.ts +102 -0
  24. package/build/src/plugins/workspace.js +170 -0
  25. package/build/src/pull-request.d.ts +10 -0
  26. package/build/src/{updaters/java/readme.js → pull-request.js} +2 -7
  27. package/build/src/release-notes.d.ts +29 -0
  28. package/build/src/release-notes.js +71 -0
  29. package/build/src/release-pull-request.d.ts +13 -0
  30. package/build/src/{updaters/java/pom-xml.js → release-pull-request.js} +2 -7
  31. package/build/src/release.d.ts +6 -0
  32. package/build/src/release.js +16 -0
  33. package/build/src/repository.d.ts +5 -0
  34. package/build/src/repository.js +16 -0
  35. package/build/src/strategies/dart.d.ts +8 -0
  36. package/build/src/strategies/dart.js +63 -0
  37. package/build/src/strategies/elixir.d.ts +5 -0
  38. package/build/src/{releasers → strategies}/elixir.js +18 -14
  39. package/build/src/strategies/go-yoshi.d.ts +13 -0
  40. package/build/src/strategies/go-yoshi.js +106 -0
  41. package/build/src/strategies/go.d.ts +5 -0
  42. package/build/src/{releasers → strategies}/go.js +11 -12
  43. package/build/src/strategies/helm.d.ts +8 -0
  44. package/build/src/strategies/helm.js +63 -0
  45. package/build/src/strategies/java-yoshi.d.ts +24 -0
  46. package/build/src/strategies/java-yoshi.js +203 -0
  47. package/build/src/strategies/krm-blueprint.d.ts +7 -0
  48. package/build/src/{releasers → strategies}/krm-blueprint.js +26 -22
  49. package/build/src/strategies/node.d.ts +9 -0
  50. package/build/src/strategies/node.js +82 -0
  51. package/build/src/strategies/ocaml.d.ts +5 -0
  52. package/build/src/{releasers → strategies}/ocaml.js +34 -28
  53. package/build/src/strategies/php-yoshi.d.ts +9 -0
  54. package/build/src/strategies/php-yoshi.js +214 -0
  55. package/build/src/strategies/php.d.ts +6 -0
  56. package/build/src/{releasers → strategies}/php.js +24 -23
  57. package/build/src/strategies/python.d.ts +8 -0
  58. package/build/src/strategies/python.js +117 -0
  59. package/build/src/strategies/ruby-yoshi.d.ts +17 -0
  60. package/build/src/strategies/ruby-yoshi.js +116 -0
  61. package/build/src/strategies/ruby.d.ts +13 -0
  62. package/build/src/{releasers → strategies}/ruby.js +26 -27
  63. package/build/src/strategies/rust.d.ts +20 -0
  64. package/build/src/strategies/rust.js +120 -0
  65. package/build/src/strategies/simple.d.ts +5 -0
  66. package/build/src/{releasers → strategies}/simple.js +18 -14
  67. package/build/src/strategies/terraform-module.d.ts +7 -0
  68. package/build/src/{releasers → strategies}/terraform-module.js +29 -23
  69. package/build/src/strategy.d.ts +99 -0
  70. package/build/src/strategy.js +237 -0
  71. package/build/src/update.d.ts +23 -0
  72. package/build/src/{updaters/update.js → update.js} +1 -1
  73. package/build/src/updaters/changelog.d.ts +7 -10
  74. package/build/src/updaters/changelog.js +3 -9
  75. package/build/src/updaters/changelog.js.map +1 -1
  76. package/build/src/updaters/composite.d.ts +19 -0
  77. package/build/src/updaters/composite.js +42 -0
  78. package/build/src/updaters/dart/pubspec-yaml.d.ts +12 -0
  79. package/build/src/updaters/{pubspec-yaml.js → dart/pubspec-yaml.js} +13 -12
  80. package/build/src/updaters/default.d.ts +21 -0
  81. package/build/src/updaters/{version-txt.js → default.js} +16 -10
  82. package/build/src/updaters/dotnet/csproj.d.ts +12 -0
  83. package/build/src/updaters/{java/google-utils.js → dotnet/csproj.js} +16 -13
  84. package/build/src/updaters/elixir/elixir-mix-exs.d.ts +12 -0
  85. package/build/src/updaters/{elixir-mix-exs.js → elixir/elixir-mix-exs.js} +12 -10
  86. package/build/src/updaters/helm/chart-yaml.d.ts +10 -11
  87. package/build/src/updaters/helm/chart-yaml.js +12 -10
  88. package/build/src/updaters/java/java-update.d.ts +14 -0
  89. package/build/src/updaters/java/{java_update.js → java-update.js} +22 -22
  90. package/build/src/updaters/java/versions-manifest.d.ts +12 -2
  91. package/build/src/updaters/java/versions-manifest.js +20 -4
  92. package/build/src/updaters/krm/krm-blueprint-version.d.ts +10 -11
  93. package/build/src/updaters/krm/krm-blueprint-version.js +13 -12
  94. package/build/src/updaters/node/package-json.d.ts +12 -0
  95. package/build/src/updaters/{package-json.js → node/package-json.js} +14 -16
  96. package/build/src/updaters/node/package-lock-json.d.ts +8 -0
  97. package/build/src/updaters/node/package-lock-json.js +36 -0
  98. package/build/src/updaters/node/samples-package-json.d.ts +23 -0
  99. package/build/src/updaters/{samples-package-json.js → node/samples-package-json.js} +19 -8
  100. package/build/src/updaters/ocaml/dune-project.d.ts +10 -11
  101. package/build/src/updaters/ocaml/dune-project.js +11 -9
  102. package/build/src/updaters/ocaml/esy-json.d.ts +10 -11
  103. package/build/src/updaters/ocaml/esy-json.js +12 -10
  104. package/build/src/updaters/ocaml/opam.d.ts +10 -11
  105. package/build/src/updaters/ocaml/opam.js +11 -9
  106. package/build/src/updaters/php/php-client-version.d.ts +12 -0
  107. package/build/src/updaters/{php-client-version.js → php/php-client-version.js} +10 -9
  108. package/build/src/updaters/php/php-manifest.d.ts +13 -0
  109. package/build/src/updaters/{php-manifest.js → php/php-manifest.js} +17 -15
  110. package/build/src/updaters/php/root-composer-update-packages.d.ts +12 -0
  111. package/build/src/updaters/{root-composer-update-packages.js → php/root-composer-update-packages.js} +17 -16
  112. package/build/src/updaters/python/pyproject-toml.d.ts +10 -11
  113. package/build/src/updaters/python/pyproject-toml.js +13 -11
  114. package/build/src/updaters/python/python-file-with-version.d.ts +7 -11
  115. package/build/src/updaters/python/python-file-with-version.js +7 -8
  116. package/build/src/updaters/python/setup-cfg.d.ts +10 -11
  117. package/build/src/updaters/python/setup-cfg.js +10 -8
  118. package/build/src/updaters/python/setup-py.d.ts +10 -11
  119. package/build/src/updaters/python/setup-py.js +10 -8
  120. package/build/src/updaters/raw-content.d.ts +19 -0
  121. package/build/src/{plugins/index.js → updaters/raw-content.js} +23 -12
  122. package/build/src/updaters/release-please-config.d.ts +8 -0
  123. package/build/src/updaters/release-please-config.js +41 -0
  124. package/build/src/updaters/release-please-manifest.d.ts +2 -11
  125. package/build/src/updaters/release-please-manifest.js +11 -14
  126. package/build/src/updaters/ruby/version-rb.d.ts +12 -0
  127. package/build/src/updaters/{version-rb.js → ruby/version-rb.js} +10 -8
  128. package/build/src/updaters/rust/cargo-lock.d.ts +7 -11
  129. package/build/src/updaters/rust/cargo-lock.js +14 -16
  130. package/build/src/updaters/rust/cargo-toml.d.ts +7 -11
  131. package/build/src/updaters/rust/cargo-toml.js +19 -21
  132. package/build/src/updaters/terraform/module-version.d.ts +10 -11
  133. package/build/src/updaters/terraform/module-version.js +11 -9
  134. package/build/src/updaters/terraform/readme.d.ts +10 -11
  135. package/build/src/updaters/terraform/readme.js +11 -10
  136. package/build/src/updaters/terraform/readme.js.map +1 -1
  137. package/build/src/util/branch-name.d.ts +5 -4
  138. package/build/src/util/branch-name.js +13 -10
  139. package/build/src/{commit-split.d.ts → util/commit-split.d.ts} +2 -4
  140. package/build/src/{commit-split.js → util/commit-split.js} +4 -2
  141. package/build/src/util/indent-commit.d.ts +1 -1
  142. package/build/src/util/logger.d.ts +5 -2
  143. package/build/src/util/logger.js +9 -4
  144. package/build/src/util/pull-request-body.d.ts +20 -0
  145. package/build/src/util/pull-request-body.js +129 -0
  146. package/build/src/util/pull-request-title.d.ts +8 -6
  147. package/build/src/util/pull-request-title.js +20 -6
  148. package/build/src/util/tag-name.d.ts +9 -0
  149. package/build/src/util/tag-name.js +41 -0
  150. package/build/src/{updaters → util}/toml-edit.d.ts +0 -0
  151. package/build/src/{updaters → util}/toml-edit.js +0 -0
  152. package/build/src/version.d.ts +11 -0
  153. package/build/src/version.js +45 -0
  154. package/build/src/versioning-strategies/always-bump-patch.d.ts +7 -0
  155. package/build/src/{updaters/package-lock-json.js → versioning-strategies/always-bump-patch.js} +8 -11
  156. package/build/src/versioning-strategies/default.d.ts +15 -0
  157. package/build/src/versioning-strategies/default.js +67 -0
  158. package/build/src/versioning-strategies/dependency-manifest.d.ts +7 -0
  159. package/build/src/versioning-strategies/dependency-manifest.js +90 -0
  160. package/build/src/versioning-strategies/java-add-snapshot.d.ts +9 -0
  161. package/build/src/versioning-strategies/java-add-snapshot.js +53 -0
  162. package/build/src/versioning-strategies/java-snapshot.d.ts +9 -0
  163. package/build/src/versioning-strategies/java-snapshot.js +67 -0
  164. package/build/src/versioning-strategies/service-pack.d.ts +7 -0
  165. package/build/src/versioning-strategies/service-pack.js +40 -0
  166. package/build/src/versioning-strategy.d.ts +28 -0
  167. package/build/src/versioning-strategy.js +55 -0
  168. package/package.json +8 -7
  169. package/build/src/constants.d.ts +0 -7
  170. package/build/src/constants.js +0 -24
  171. package/build/src/conventional-commits.d.ts +0 -53
  172. package/build/src/conventional-commits.js +0 -167
  173. package/build/src/github-release.d.ts +0 -34
  174. package/build/src/github-release.js +0 -92
  175. package/build/src/graphql-to-commits.d.ts +0 -60
  176. package/build/src/graphql-to-commits.js +0 -112
  177. package/build/src/index.d.ts +0 -95
  178. package/build/src/index.js +0 -32
  179. package/build/src/plugins/index.d.ts +0 -5
  180. package/build/src/plugins/plugin.d.ts +0 -21
  181. package/build/src/release-pr.d.ts +0 -101
  182. package/build/src/release-pr.js +0 -461
  183. package/build/src/releasers/dart.d.ts +0 -9
  184. package/build/src/releasers/dart.js +0 -65
  185. package/build/src/releasers/elixir.d.ts +0 -5
  186. package/build/src/releasers/go-yoshi.d.ts +0 -10
  187. package/build/src/releasers/go-yoshi.js +0 -162
  188. package/build/src/releasers/go.d.ts +0 -6
  189. package/build/src/releasers/helm.d.ts +0 -9
  190. package/build/src/releasers/helm.js +0 -66
  191. package/build/src/releasers/index.d.ts +0 -7
  192. package/build/src/releasers/index.js +0 -76
  193. package/build/src/releasers/java/bump_type.d.ts +0 -4
  194. package/build/src/releasers/java/bump_type.js +0 -38
  195. package/build/src/releasers/java/stability.d.ts +0 -5
  196. package/build/src/releasers/java/stability.js +0 -37
  197. package/build/src/releasers/java/version.d.ts +0 -13
  198. package/build/src/releasers/java/version.js +0 -112
  199. package/build/src/releasers/java-backport.d.ts +0 -9
  200. package/build/src/releasers/java-backport.js +0 -43
  201. package/build/src/releasers/java-bom.d.ts +0 -16
  202. package/build/src/releasers/java-bom.js +0 -83
  203. package/build/src/releasers/java-lts.d.ts +0 -9
  204. package/build/src/releasers/java-lts.js +0 -47
  205. package/build/src/releasers/java-yoshi.d.ts +0 -28
  206. package/build/src/releasers/java-yoshi.js +0 -304
  207. package/build/src/releasers/krm-blueprint.d.ts +0 -6
  208. package/build/src/releasers/node.d.ts +0 -10
  209. package/build/src/releasers/node.js +0 -84
  210. package/build/src/releasers/ocaml.d.ts +0 -5
  211. package/build/src/releasers/php-yoshi.d.ts +0 -5
  212. package/build/src/releasers/php-yoshi.js +0 -191
  213. package/build/src/releasers/php.d.ts +0 -7
  214. package/build/src/releasers/python.d.ts +0 -11
  215. package/build/src/releasers/python.js +0 -127
  216. package/build/src/releasers/ruby-yoshi.d.ts +0 -5
  217. package/build/src/releasers/ruby-yoshi.js +0 -142
  218. package/build/src/releasers/ruby.d.ts +0 -11
  219. package/build/src/releasers/rust.d.ts +0 -30
  220. package/build/src/releasers/rust.js +0 -163
  221. package/build/src/releasers/simple.d.ts +0 -5
  222. package/build/src/releasers/terraform-module.d.ts +0 -6
  223. package/build/src/updaters/elixir-mix-exs.d.ts +0 -13
  224. package/build/src/updaters/java/google-utils.d.ts +0 -13
  225. package/build/src/updaters/java/java_update.d.ts +0 -13
  226. package/build/src/updaters/java/pom-xml.d.ts +0 -3
  227. package/build/src/updaters/java/readme.d.ts +0 -3
  228. package/build/src/updaters/java/readme.js.map +0 -1
  229. package/build/src/updaters/package-json.d.ts +0 -16
  230. package/build/src/updaters/package-lock-json.d.ts +0 -7
  231. package/build/src/updaters/php-client-version.d.ts +0 -13
  232. package/build/src/updaters/php-manifest.d.ts +0 -13
  233. package/build/src/updaters/pubspec-yaml.d.ts +0 -13
  234. package/build/src/updaters/root-composer-update-package.d.ts +0 -13
  235. package/build/src/updaters/root-composer-update-package.js +0 -45
  236. package/build/src/updaters/root-composer-update-packages.d.ts +0 -13
  237. package/build/src/updaters/samples-package-json.d.ts +0 -13
  238. package/build/src/updaters/update.d.ts +0 -20
  239. package/build/src/updaters/version-rb.d.ts +0 -13
  240. package/build/src/updaters/version-txt.d.ts +0 -12
  241. package/build/src/updaters/version.d.ts +0 -13
  242. package/build/src/updaters/version.js +0 -31
  243. package/build/src/util/checkpoint.d.ts +0 -6
  244. package/build/src/util/checkpoint.js +0 -33
  245. package/build/src/util/release-notes.d.ts +0 -7
  246. package/build/src/util/release-notes.js +0 -34
  247. package/build/src/util/to-conventional-changelog-format.d.ts +0 -2
@@ -1,220 +1,112 @@
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;
91
45
  }
92
46
  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[]>;
47
+ readonly repository: Repository;
48
+ private octokit;
49
+ private request;
50
+ private graphql;
51
+ private constructor();
118
52
  /**
119
- * Returns the list of commits since a given SHA on the target branch
53
+ * Build a new GitHub client with auto-detected default branch.
120
54
  *
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
55
+ * @param {GitHubCreateOptions} options Configuration options
56
+ * @param {string} options.owner The repository owner.
57
+ * @param {string} options.repo The repository name.
58
+ * @param {string} options.defaultBranch Optional. The repository's default branch.
59
+ * Defaults to the value fetched via the API.
60
+ * @param {string} options.apiUrl Optional. The base url of the GitHub API.
61
+ * @param {string} options.graphqlUrl Optional. The base url of the GraphQL API.
62
+ * @param {OctokitAPISs} options.octokitAPIs Optional. Override the internal
63
+ * client instances with a pre-authenticated instance.
64
+ * @param {string} token Optional. A GitHub API token used for authentication.
129
65
  */
130
- commitsSinceSha(sha: string | undefined, perPage?: number, labels?: boolean, path?: string | null): Promise<Commit[]>;
131
- private commitsWithFiles;
132
- private commitsWithLabels;
66
+ static create(options: GitHubCreateOptions): Promise<GitHub>;
133
67
  /**
134
- * Return the pull request files
68
+ * Returns the default branch for a given repository.
135
69
  *
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
70
+ * @param {string} owner The GitHub repository owner
71
+ * @param {string} repo The GitHub repository name
72
+ * @param {OctokitType} octokit An authenticated octokit instance
73
+ * @returns {string} Name of the default branch
141
74
  */
142
- pullRequestFiles(num: number, cursor: string, maxFilesChanged?: number): Promise<PREdge>;
75
+ static defaultBranch(owner: string, repo: string, octokit: OctokitType): Promise<string>;
143
76
  /**
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.
77
+ * Returns the list of commits to the default branch after the provided filter
78
+ * query has been satified.
179
79
  *
180
- * @param {CommitFilter} filter - Callback function that returns whether a
80
+ * @param {string} targetBranch Target branch of commit
81
+ * @param {CommitFilter} filter Callback function that returns whether a
181
82
  * commit/pull request matches certain criteria
182
- * @param {number} maxResults - Limit the number of results searched.
83
+ * @param {number} maxResults Limit the number of results searched.
183
84
  * Defaults to unlimited.
184
- * @returns {CommitWithPullRequest}
85
+ * @returns {Commit[]} List of commits to current branch
185
86
  * @throws {GitHubAPIError} on an API error
186
87
  */
187
- findMergeCommit(filter: CommitFilter, maxResults?: number): Promise<CommitWithPullRequest | undefined>;
88
+ commitsSince(targetBranch: string, filter: CommitFilter, maxResults?: number): Promise<Commit[]>;
188
89
  /**
189
90
  * Iterate through commit history with a max number of results scanned.
190
91
  *
191
- * @param maxResults {number} maxResults - Limit the number of results searched.
92
+ * @param {string} targetBranch target branch of commit
93
+ * @param {number} maxResults maxResults - Limit the number of results searched.
192
94
  * Defaults to unlimited.
193
- * @yields {CommitWithPullRequest}
95
+ * @yields {Commit}
194
96
  * @throws {GitHubAPIError} on an API error
195
97
  */
196
- mergeCommitIterator(maxResults?: number): AsyncGenerator<CommitWithPullRequest, void, unknown>;
98
+ mergeCommitIterator(targetBranch: string, maxResults?: number): AsyncGenerator<Commit, void, unknown>;
99
+ private mergeCommitsGraphQL;
100
+ private graphqlRequest;
197
101
  /**
198
102
  * Iterate through merged pull requests with a max number of results scanned.
199
103
  *
200
- * @param maxResults {number} maxResults - Limit the number of results searched.
104
+ * @param {number} maxResults maxResults - Limit the number of results searched.
201
105
  * Defaults to unlimited.
202
- * @yields {MergedGitHubPR}
106
+ * @yields {PullRequest}
203
107
  * @throws {GitHubAPIError} on an API error
204
108
  */
205
- mergedPullRequestIterator(branch: string, maxResults?: number): AsyncGenerator<MergedGitHubPR, void, unknown>;
206
- /**
207
- * Returns the list of commits to the default branch after the provided filter
208
- * query has been satified.
209
- *
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.
213
- * Defaults to unlimited.
214
- * @returns {Commit[]} - List of commits to current branch
215
- * @throws {GitHubAPIError} on an API error
216
- */
217
- commitsSince(filter: CommitFilter, maxResults?: number): Promise<Commit[]>;
109
+ pullRequestIterator(targetBranch: string, status?: 'OPEN' | 'CLOSED' | 'MERGED', maxResults?: number): AsyncGenerator<PullRequest, void, unknown>;
218
110
  /**
219
111
  * Return a list of merged pull requests. The list is not guaranteed to be sorted
220
112
  * by merged_at, but is generally most recent first.
@@ -223,601 +115,37 @@ export declare class GitHub {
223
115
  * the configured default branch.
224
116
  * @param {number} page - Page of results. Defaults to 1.
225
117
  * @param {number} perPage - Number of results per page. Defaults to 100.
226
- * @returns {MergedGitHubPR[]} - List of merged pull requests
227
- * @throws {GitHubAPIError} on an API error
228
- */
229
- findMergedPullRequests: (targetBranch?: string | undefined, page?: any, perPage?: any) => Promise<MergedGitHubPR[]>;
230
- /**
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.
118
+ * @returns {PullRequestHistory | null} - List of merged pull requests
242
119
  * @throws {GitHubAPIError} on an API error
243
120
  */
244
- findMergedPullRequest(targetBranch: string, filter: MergedPullRequestFilter, maxResults?: number): Promise<MergedGitHubPR | undefined>;
121
+ private pullRequestsGraphQL;
245
122
  /**
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.
123
+ * Iterate through merged pull requests with a max number of results scanned.
250
124
  *
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.
125
+ * @param {number} maxResults maxResults - Limit the number of results searched.
258
126
  * Defaults to unlimited.
259
- * @returns {MergedGitHubPR|undefined}
127
+ * @yields {GitHubRelease}
260
128
  * @throws {GitHubAPIError} on an API error
261
129
  */
262
- findMergedReleasePR(labels: string[], branchPrefix?: string | undefined, preRelease?: boolean, maxResults?: number): Promise<MergedGitHubPR | undefined>;
263
- private hasAllLabels;
130
+ releaseIterator(maxResults?: number): AsyncGenerator<GitHubRelease, void, unknown>;
131
+ private releaseGraphQL;
264
132
  /**
265
- * Find open pull requests with matching labels.
133
+ * Return a list of tags. The list is not guaranteed to be sorted.
266
134
  *
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
135
+ * @param {number} page - Page of results. Defaults to 1.
136
+ * @param {number} perPage - Number of results per page. Defaults to 100.
137
+ * @returns {GitHubRelease[]} - List of tags
279
138
  * @throws {GitHubAPIError} on an API error
280
139
  */
281
- addLabels(labels: string[], pr: number): Promise<boolean>;
140
+ private listReleases;
282
141
  /**
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,15 @@ 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) => Promise<GitHubRelease>;
931
280
  /**
932
281
  * Makes a comment on a issue/pull request.
933
282
  *
@@ -935,102 +284,20 @@ export declare class GitHub {
935
284
  * @param {number} number - The issue or pull request number.
936
285
  * @throws {GitHubAPIError} on an API error
937
286
  */
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
- }>;
287
+ commentOnIssue: (comment: string, number: number) => Promise<string>;
288
+ /**
289
+ * Removes labels from an issue/pull request.
290
+ *
291
+ * @param {string[]} labels The labels to remove.
292
+ * @param {number} number The issue/pull request number.
293
+ */
294
+ removeIssueLabels: (labels: string[], number: number) => Promise<void>;
295
+ /**
296
+ * Adds label to an issue/pull request.
297
+ *
298
+ * @param {string[]} labels The labels to add.
299
+ * @param {number} number The issue/pull request number.
300
+ */
301
+ addIssueLabels: (labels: string[], number: number) => Promise<void>;
1035
302
  }
1036
303
  export {};