From 1bcdd0c019f29ad522ba46d210df10af670d96ec Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Thu, 27 Aug 2026 18:56:47 +0100 Subject: [PATCH] Derive the API client type from `@actions/github` `ApiClient` was hand-composed from `Octokit`, `Api` and `PaginateInterface`, imported directly from separately versioned Octokit packages. That asserted a shape matching what `@actions/github` actually returns, which held only while the versions happened to agree. `@octokit/plugin-rest-endpoint-methods` v18 adds twelve Actions cache-limit methods. `@actions/github` still depends on `^17.0.0`, so the client it constructs no longer satisfies the v18-derived alias and the build fails. Deriving the type from the constructor removes the assumption, so the alias tracks whatever `@actions/github` returns. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- lib/entry-points.js | 16 ++++++++-------- pr-checks/api-client.ts | 5 +---- src/api-client.ts | 5 +---- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 95d1cc64a..8cbf9a593 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -23510,18 +23510,18 @@ var init_dist_src2 = __esm({ } }); -// node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js +// node_modules/@actions/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js var VERSION5; var init_version2 = __esm({ - "node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js"() { + "node_modules/@actions/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js"() { VERSION5 = "17.0.0"; } }); -// node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js +// node_modules/@actions/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js var Endpoints, endpoints_default; var init_endpoints = __esm({ - "node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js"() { + "node_modules/@actions/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js"() { Endpoints = { actions: { addCustomLabelsToSelfHostedRunnerForOrg: [ @@ -25815,7 +25815,7 @@ var init_endpoints = __esm({ } }); -// node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js +// node_modules/@actions/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js function endpointsToMethods(octokit) { const newMethods = {}; for (const scope of endpointMethodsMap.keys()) { @@ -25866,7 +25866,7 @@ function decorate(octokit, scope, methodName, defaults3, decorations) { } var endpointMethodsMap, handler; var init_endpoints_to_methods = __esm({ - "node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js"() { + "node_modules/@actions/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js"() { init_endpoints(); endpointMethodsMap = /* @__PURE__ */ new Map(); for (const [scope, endpoints] of Object.entries(endpoints_default)) { @@ -25944,7 +25944,7 @@ var init_endpoints_to_methods = __esm({ } }); -// node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js +// node_modules/@actions/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js var dist_src_exports2 = {}; __export(dist_src_exports2, { legacyRestEndpointMethods: () => legacyRestEndpointMethods, @@ -25964,7 +25964,7 @@ function legacyRestEndpointMethods(octokit) { }; } var init_dist_src3 = __esm({ - "node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js"() { + "node_modules/@actions/github/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js"() { init_version2(); init_endpoints_to_methods(); restEndpointMethods.VERSION = VERSION5; diff --git a/pr-checks/api-client.ts b/pr-checks/api-client.ts index 93675dba7..b8f914d81 100644 --- a/pr-checks/api-client.ts +++ b/pr-checks/api-client.ts @@ -1,10 +1,7 @@ import * as githubUtils from "@actions/github/lib/utils"; -import { type Octokit } from "@octokit/core"; -import { type PaginateInterface } from "@octokit/plugin-paginate-rest"; -import { type Api } from "@octokit/plugin-rest-endpoint-methods"; /** The type of the Octokit client. */ -export type ApiClient = Octokit & Api & { paginate: PaginateInterface }; +export type ApiClient = InstanceType; /** Constructs an `ApiClient` using `token` for authentication. */ export function getApiClient(token: string): ApiClient { diff --git a/src/api-client.ts b/src/api-client.ts index ba800a258..bc6018877 100644 --- a/src/api-client.ts +++ b/src/api-client.ts @@ -1,8 +1,5 @@ import * as core from "@actions/core"; import * as githubUtils from "@actions/github/lib/utils"; -import { type Octokit } from "@octokit/core"; -import { type PaginateInterface } from "@octokit/plugin-paginate-rest"; -import { type Api } from "@octokit/plugin-rest-endpoint-methods"; import * as retry from "@octokit/plugin-retry"; import { RequestRequestOptions } from "@octokit/types"; import { @@ -128,7 +125,7 @@ export function makeProxyRequestOptions( } /** The type of GitHub API client we use. */ -export type ApiClient = Octokit & Api & { paginate: PaginateInterface }; +export type ApiClient = InstanceType; /** Options for `createApiClientWithDetails`. */ interface CreateApiClientOptions {