File tree Expand file tree Collapse file tree 2 files changed +14
-13
lines changed
Expand file tree Collapse file tree 2 files changed +14
-13
lines changed Original file line number Diff line number Diff line change 1+ import * as githubUtils from "@actions/github/lib/utils" ;
2+ import { type Octokit } from "@octokit/core" ;
3+ import { type PaginateInterface } from "@octokit/plugin-paginate-rest" ;
4+ import { type Api } from "@octokit/plugin-rest-endpoint-methods" ;
5+
6+ /** The type of the Octokit client. */
7+ export type ApiClient = Octokit & Api & { paginate : PaginateInterface } ;
8+
9+ /** Constructs an `ApiClient` using `token` for authentication. */
10+ export function getApiClient ( token : string ) : ApiClient {
11+ const opts = githubUtils . getOctokitOptions ( token ) ;
12+ return new githubUtils . GitHub ( opts ) ;
13+ }
Original file line number Diff line number Diff line change 55import * as fs from "fs" ;
66import { parseArgs } from "node:util" ;
77
8- import * as githubUtils from "@actions/github/lib/utils" ;
9- import { type Octokit } from "@octokit/core" ;
10- import { type PaginateInterface } from "@octokit/plugin-paginate-rest" ;
11- import { type Api } from "@octokit/plugin-rest-endpoint-methods" ;
128import * as yaml from "yaml" ;
139
10+ import { type ApiClient , getApiClient } from "./api-client" ;
1411import {
1512 OLDEST_SUPPORTED_MAJOR_VERSION ,
1613 PR_CHECK_EXCLUDED_FILE ,
@@ -49,15 +46,6 @@ function loadExclusions(): Exclusions {
4946 ) as Exclusions ;
5047}
5148
52- /** The type of the Octokit client. */
53- type ApiClient = Octokit & Api & { paginate : PaginateInterface } ;
54-
55- /** Constructs an `ApiClient` using `token` for authentication. */
56- function getApiClient ( token : string ) : ApiClient {
57- const opts = githubUtils . getOctokitOptions ( token ) ;
58- return new githubUtils . GitHub ( opts ) ;
59- }
60-
6149/**
6250 * Represents information about a check run. We track the `app_id` that generated the check,
6351 * because the API will require it in addition to the name in the future.
You can’t perform that action at this time.
0 commit comments