diff --git a/src/action-common.ts b/src/action-common.ts index 2f071ce20..5ea008d01 100644 --- a/src/action-common.ts +++ b/src/action-common.ts @@ -1,8 +1,9 @@ import * as core from "@actions/core"; import { ActionsEnv, getActionsEnv } from "./actions-util"; +import type { ApiClient } from "./api-client"; import { Env, ReadOnlyEnv } from "./environment"; -import { FeatureEnablement } from "./feature-flags"; +import type { FeatureEnablement } from "./feature-flags"; import { getActionsLogger, Logger } from "./logging"; import { ActionName, @@ -36,6 +37,10 @@ export interface FeatureState { /** Access to Actions-related functionality. */ actions: ActionsEnv; }; + Api: { + /** A GitHub API client. */ + apiClient: ApiClient; + }; FeatureFlags: { /** Information about enabled feature flags. */ features: FeatureEnablement; diff --git a/src/testing-utils.ts b/src/testing-utils.ts index c234e2e50..8ef102caf 100644 --- a/src/testing-utils.ts +++ b/src/testing-utils.ts @@ -193,7 +193,14 @@ export function getTestActionsEnv(): ActionsEnv { } /** For testing purposes, we make all available state features accessible in `TestEnv`. */ -type AllState = ["Logger", "Env", "ReadOnlyEnv", "Actions", "FeatureFlags"]; +type AllState = [ + "Logger", + "Env", + "ReadOnlyEnv", + "Actions", + "Api", + "FeatureFlags", +]; /** Initialise a fresh `ActionState` value. */ export function initAllState( @@ -205,6 +212,7 @@ export function initAllState( logger: new RecordingLogger(), env: getTestEnv(), actions: getTestActionsEnv(), + apiClient: github.getOctokit("123"), features: createFeatures([]), ...overrides, };