Add getRequiredInput to ActionsEnv

This commit is contained in:
Michael B. Gale
2026-07-24 17:40:26 +01:00
parent 766928d055
commit e9831f72a2
3 changed files with 6 additions and 2 deletions

2
lib/entry-points.js generated
View File

@@ -145383,7 +145383,7 @@ var Failure = class {
// src/actions-util.ts // src/actions-util.ts
function getActionsEnv() { function getActionsEnv() {
return { getOptionalInput }; return { getRequiredInput, getOptionalInput };
} }
var getRequiredInput = function(name) { var getRequiredInput = function(name) {
const value = core3.getInput(name); const value = core3.getInput(name);

View File

@@ -27,6 +27,7 @@ declare const __CODEQL_ACTION_VERSION__: string;
* global functions in tests. * global functions in tests.
*/ */
export interface ActionsEnv { export interface ActionsEnv {
getRequiredInput: (name: string) => string;
getOptionalInput: (name: string) => string | undefined; getOptionalInput: (name: string) => string | undefined;
} }
@@ -34,7 +35,7 @@ export interface ActionsEnv {
* Gets the real `ActionsEnv` used by production code. * Gets the real `ActionsEnv` used by production code.
*/ */
export function getActionsEnv(): ActionsEnv { export function getActionsEnv(): ActionsEnv {
return { getOptionalInput }; return { getRequiredInput, getOptionalInput };
} }
/** /**

View File

@@ -187,6 +187,9 @@ export function getTestEnv(testEnv: NodeJS.ProcessEnv = {}): Env {
*/ */
export function getTestActionsEnv(): ActionsEnv { export function getTestActionsEnv(): ActionsEnv {
return { return {
getRequiredInput: (name) => {
throw new Error(`Input required and not supplied: ${name}`);
},
getOptionalInput: () => undefined, getOptionalInput: () => undefined,
}; };
} }