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
function getActionsEnv() {
return { getOptionalInput };
return { getRequiredInput, getOptionalInput };
}
var getRequiredInput = function(name) {
const value = core3.getInput(name);

View File

@@ -27,6 +27,7 @@ declare const __CODEQL_ACTION_VERSION__: string;
* global functions in tests.
*/
export interface ActionsEnv {
getRequiredInput: (name: string) => string;
getOptionalInput: (name: string) => string | undefined;
}
@@ -34,7 +35,7 @@ export interface ActionsEnv {
* Gets the real `ActionsEnv` used by production code.
*/
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 {
return {
getRequiredInput: (name) => {
throw new Error(`Input required and not supplied: ${name}`);
},
getOptionalInput: () => undefined,
};
}