Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
c512861
Extend `UserConfig` type to be aware of Default Setup properties
mbg Jul 3, 2026
cd604f8
Refactor `determineUserConfig` out of `initConfig`
mbg Jul 3, 2026
a52a966
Add `mergeUserConfigs` with tests
mbg Jul 3, 2026
132634d
Add FF for configuration merging
mbg Jul 6, 2026
53a488c
Add JSDoc for `loadUserConfig`
mbg Jul 6, 2026
6860cc1
Move `validateConfig` FF query
mbg Jul 6, 2026
0188f39
Add unit tests for existing behaviour of `determineUserConfig`
mbg Jul 6, 2026
d1db924
Allow `env` input for relevant functions in `actions-util.ts`
mbg Jul 6, 2026
18d20b7
Allow setting environment variables
mbg Jul 6, 2026
3157774
Give `determineUserConfig` access to the environment
mbg Jul 6, 2026
42c0c6a
Allow merging Default Setup `config` with config file
mbg Jul 6, 2026
3707b44
Document that `inputs` might be mutated
mbg Jul 6, 2026
d149f93
Return `mergedConfig` instead of loading it again
mbg Jul 6, 2026
764f470
Test `inputs.configFile` mutation in tests
mbg Jul 6, 2026
9a06fa6
Set the required `workspacePath` input
mbg Jul 6, 2026
44d6b3b
Initialise `env` in `actions-util` when not provided
mbg Jul 6, 2026
4509fb3
Fix JSDoc for `determineUserConfig`
mbg Jul 6, 2026
8476401
Make lazy FF check less ambiguous
mbg Jul 6, 2026
8be707b
Merge remote-tracking branch 'origin/main' into mbg/config/merge
mbg Jul 6, 2026
7ccd988
Merge branch 'main' into mbg/config/merge
mbg Jul 8, 2026
06898d7
Rename `mergeUserConfigs`
mbg Jul 8, 2026
d2472aa
Merge remote-tracking branch 'origin/main' into mbg/config/merge
mbg Jul 9, 2026
6829d6c
Remove obsolete JSDoc parameter for `loadUserConfig`
mbg Jul 9, 2026
6973946
Check file on disk and mutated inputs
mbg Jul 9, 2026
dc2d916
Add `checkSchema` function
mbg Jul 9, 2026
1f91ec8
Add an `array` `Validator`
mbg Jul 9, 2026
98dbd66
Add an `object` `Validator`
mbg Jul 9, 2026
9573f05
Improve type inference for `object` and `validateSchema`
mbg Jul 9, 2026
847e7af
Log warning for unrecognised keys in Default Setup config
mbg Jul 9, 2026
7c961fa
Add diagnostic for unrecognised keys
mbg Jul 9, 2026
cee0056
Allow nested checking
mbg Jul 9, 2026
e4752e7
Remove keys from unrecognised set as soon as found
mbg Jul 10, 2026
8d8f054
Add convenience functions to produce `CheckSchemaResult` values
mbg Jul 10, 2026
512bf6f
Track invalid keys, and use more standard JSON path notation
mbg Jul 10, 2026
0b10dee
Propagate `CheckSchemaOptions` to allow `failFast` to work as intended
mbg Jul 10, 2026
e26215c
fixup! Track invalid keys, and use more standard JSON path notation
mbg Jul 10, 2026
26cbf9f
Don't include nested keys that are unknown
mbg Jul 10, 2026
f630f8f
Report invalid keys separately
mbg Jul 10, 2026
66c15f4
Merge remote-tracking branch 'origin/main' into mbg/config/merge
mbg Jul 13, 2026
2773684
Update test for changed test API
mbg Jul 13, 2026
f181d70
Update `determineUserConfig` tests to use new framework
mbg Jul 13, 2026
7577328
Return function result from `passes` alongside assertion result
mbg Jul 13, 2026
3d2713f
Merge remote-tracking branch 'origin/main' into mbg/config/merge
mbg Jul 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Propagate CheckSchemaOptions to allow failFast to work as intended
  • Loading branch information
mbg committed Jul 10, 2026
commit 0b10dee3eedd74fb04bf7e96b85cc5851eb684be
21 changes: 12 additions & 9 deletions lib/entry-points.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 19 additions & 10 deletions src/json/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ export function isStringOrUndefined(
*/
export type Validator<T> = {
validate: (val: unknown) => val is T;
check: (val: unknown, path: string) => CheckSchemaResult;
check: (
val: unknown,
opts: CheckSchemaOptions,
path: string,
) => CheckSchemaResult;
required: boolean;
};

Expand Down Expand Up @@ -85,7 +89,7 @@ export function array<T>(validator: Validator<T>) {
};
return {
validate,
check: (val: unknown, path: string) => {
check: (val: unknown, opts: CheckSchemaOptions, path: string) => {
const result: CheckSchemaResult = successfulCheckSchema();

// The value must be an array.
Expand All @@ -98,14 +102,19 @@ export function array<T>(validator: Validator<T>) {
let index = 0;
for (const e of val) {
const elementPath = `${path}[${index}]`;
const eResult = validator.check(e, `${elementPath}`);
const eResult = validator.check(e, opts, `${elementPath}`);

Comment thread
mbg marked this conversation as resolved.
result.unknownKeys.push(...eResult.unknownKeys);
index++;

if (!eResult.valid) {
result.valid = false;
result.invalidKeys.push(elementPath);

if (opts.failFast) {
return result;
}

continue;
}
}
Comment thread
mbg marked this conversation as resolved.
Expand All @@ -125,11 +134,11 @@ export function object<
validate: (val: unknown) => {
return isObject(val) && validateSchema<S, T>(schema, val);
},
check: (val, path) => {
check: (val, opts, path) => {
if (!isObject(val)) {
return invalidCheckSchema();
}
return checkSchema(schema, val, {}, path);
return checkSchema(schema, val, opts, path);
},
required: true,
} as const satisfies Validator<T>;
Expand All @@ -144,11 +153,11 @@ export function optionalOrNull<T>(validator: Validator<T>) {
validate: (val: unknown) => {
return val === undefined || val === null || validator.validate(val);
},
check: (val, path) => {
check: (val, opts, path) => {
if (val === undefined || val === null) {
return successfulCheckSchema();
}
return validator.check(val, path);
return validator.check(val, opts, path);
},
required: false,
} as const satisfies Validator<T | undefined | null>;
Expand All @@ -163,11 +172,11 @@ export function optional<T>(validator: Validator<T>) {
validate: (val: unknown): val is T | undefined => {
return val === undefined || validator.validate(val);
},
check: (val, path) => {
check: (val, opts, path) => {
if (val === undefined) {
return successfulCheckSchema();
}
return validator.check(val, path);
return validator.check(val, opts, path);
},
required: false,
} as const satisfies Validator<T | undefined>;
Expand Down Expand Up @@ -284,7 +293,7 @@ export function checkSchema<S extends Schema>(

// If the property is present, validate it.
if (hasKey) {
const checkResult = validator.check(obj[key], `${path}.${key}`);
const checkResult = validator.check(obj[key], options, `${path}.${key}`);

result.unknownKeys.push(...checkResult.unknownKeys);
result.invalidKeys.push(...checkResult.invalidKeys);
Expand Down