diff --git a/src/action-common.ts b/src/action-common.ts index 5ea008d01..9929a0016 100644 --- a/src/action-common.ts +++ b/src/action-common.ts @@ -22,6 +22,7 @@ export interface BaseState { /** Describes different state features that an Action may have. */ export interface FeatureState { + Base: BaseState; Logger: { /** The logger that is in use. */ logger: Logger; @@ -52,7 +53,7 @@ export type StateFeature = keyof FeatureState; /** Constructs the intersection of all state types identifies by `Fs`. */ export type FieldsOf = Fs extends [] - ? BaseState + ? Record : Fs extends [ infer Head extends StateFeature, ...infer Tail extends readonly StateFeature[], @@ -68,7 +69,7 @@ export type ActionState = FieldsOf; * Each Action can then augment the `state` further if additional features are required. */ export type ActionMain = ( - state: ActionState<["Logger", "Env", "Actions"]>, + state: ActionState<["Base", "Logger", "Env", "Actions"]>, ) => Promise; /** A specification for a CodeQL Action step. */ diff --git a/src/analyze-action.ts b/src/analyze-action.ts index f7cbbaabe..5104719bc 100644 --- a/src/analyze-action.ts +++ b/src/analyze-action.ts @@ -212,7 +212,7 @@ async function runAutobuildIfLegacyGoWorkflow(config: Config, logger: Logger) { await runAutobuild(config, BuiltInLanguage.go, logger); } -async function run({ startedAt, logger }: ActionState<["Logger"]>) { +async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. diff --git a/src/autobuild-action.ts b/src/autobuild-action.ts index afda0e236..b78bffb9d 100644 --- a/src/autobuild-action.ts +++ b/src/autobuild-action.ts @@ -68,7 +68,7 @@ async function sendCompletedStatusReport( } } -async function run({ startedAt, logger }: ActionState<["Logger"]>) { +async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. diff --git a/src/init-action.ts b/src/init-action.ts index acaba701b..8d0434160 100644 --- a/src/init-action.ts +++ b/src/init-action.ts @@ -203,7 +203,9 @@ async function sendCompletedStatusReport( } } -async function run(actionState: ActionState<["Logger", "Env", "Actions"]>) { +async function run( + actionState: ActionState<["Base", "Logger", "Env", "Actions"]>, +) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. diff --git a/src/setup-codeql-action.ts b/src/setup-codeql-action.ts index a6b5f83f5..3336afc1a 100644 --- a/src/setup-codeql-action.ts +++ b/src/setup-codeql-action.ts @@ -90,7 +90,7 @@ async function sendCompletedStatusReport( async function run({ startedAt, logger, -}: ActionState<["Logger"]>): Promise { +}: ActionState<["Base", "Logger"]>): Promise { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. diff --git a/src/testing-utils.ts b/src/testing-utils.ts index 8ef102caf..3bd30320e 100644 --- a/src/testing-utils.ts +++ b/src/testing-utils.ts @@ -194,6 +194,7 @@ export function getTestActionsEnv(): ActionsEnv { /** For testing purposes, we make all available state features accessible in `TestEnv`. */ type AllState = [ + "Base", "Logger", "Env", "ReadOnlyEnv", diff --git a/src/upload-sarif-action.ts b/src/upload-sarif-action.ts index 214f3bf98..d3437510c 100644 --- a/src/upload-sarif-action.ts +++ b/src/upload-sarif-action.ts @@ -54,7 +54,7 @@ async function sendSuccessStatusReport( } } -async function run({ startedAt, logger }: ActionState<["Logger"]>) { +async function run({ startedAt, logger }: ActionState<["Base", "Logger"]>) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. try {