Skip to content

Commit e9831f7

Browse files
committed
Add getRequiredInput to ActionsEnv
1 parent 766928d commit e9831f7

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/actions-util.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ declare const __CODEQL_ACTION_VERSION__: string;
2727
* global functions in tests.
2828
*/
2929
export interface ActionsEnv {
30+
getRequiredInput: (name: string) => string;
3031
getOptionalInput: (name: string) => string | undefined;
3132
}
3233

3334
/**
3435
* Gets the real `ActionsEnv` used by production code.
3536
*/
3637
export function getActionsEnv(): ActionsEnv {
37-
return { getOptionalInput };
38+
return { getRequiredInput, getOptionalInput };
3839
}
3940

4041
/**

‎src/testing-utils.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ export function getTestEnv(testEnv: NodeJS.ProcessEnv = {}): Env {
187187
*/
188188
export function getTestActionsEnv(): ActionsEnv {
189189
return {
190+
getRequiredInput: (name) => {
191+
throw new Error(`Input required and not supplied: ${name}`);
192+
},
190193
getOptionalInput: () => undefined,
191194
};
192195
}

0 commit comments

Comments
 (0)