Skip to content

Commit 1542951

Browse files
committed
Type the API client
1 parent 4fb6147 commit 1542951

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎src/api-client.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import * as core from "@actions/core";
22
import * as githubUtils from "@actions/github/lib/utils";
3+
import { type Octokit } from "@octokit/core";
4+
import { type PaginateInterface } from "@octokit/plugin-paginate-rest";
5+
import { type Api } from "@octokit/plugin-rest-endpoint-methods";
36
import * as retry from "@octokit/plugin-retry";
47

58
import { getActionVersion, getRequiredInput } from "./actions-util";
@@ -43,10 +46,13 @@ export interface GitHubApiExternalRepoDetails {
4346
apiURL: string | undefined;
4447
}
4548

49+
/** The type of GitHub API client we use. */
50+
export type ApiClient = Octokit & Api & { paginate: PaginateInterface };
51+
4652
function createApiClientWithDetails(
4753
apiDetails: GitHubApiCombinedDetails,
4854
{ allowExternal = false } = {},
49-
) {
55+
): ApiClient {
5056
const auth =
5157
(allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth;
5258
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);

0 commit comments

Comments
 (0)