Add Api to ActionState

This commit is contained in:
Michael B. Gale committed 2026-07-14 10:09:03 +01:00
1 parent 1542951d09
commit 2dbfdcaa83
2 files changed
+15 -2

No files matched your search

+6 -1
View File
@@ -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;
+9 -1
View File
@@ -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<AllState>` 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,
};