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