move checking to when env vars are constructed
This commit is contained in:
parent
70980b9f32
commit
24367a89b5
6 changed files with 25 additions and 22 deletions
9
lib/config-utils.js
generated
9
lib/config-utils.js
generated
|
|
@ -112,8 +112,6 @@ const pathStarsRegex = /.*(?:\*\*[^/].*|\*\*$|[^/]\*\*.*)/;
|
|||
// Characters that are supported by filters in workflows, but not by us.
|
||||
// See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
|
||||
const filterPatternCharactersRegex = /.*[\?\+\[\]!].*/;
|
||||
// Matches any string containing characters that are illegal to include in paths on windows.
|
||||
exports.illegalWindowsCharactersRegex = /.*[<>:"\|?*].*/;
|
||||
// Checks that a paths of paths-ignore entry is valid, possibly modifying it
|
||||
// to make it valid, or if not possible then throws an error.
|
||||
function validateAndSanitisePath(originalPath, propertyName, configFile) {
|
||||
|
|
@ -136,12 +134,7 @@ function validateAndSanitisePath(originalPath, propertyName, configFile) {
|
|||
// Output a warning so the user knows, but otherwise continue normally.
|
||||
if (path.match(filterPatternCharactersRegex)) {
|
||||
core.warning(getConfigFilePropertyError(configFile, propertyName, '"' + originalPath + '" contains an unsupported character. ' +
|
||||
'The filter pattern characteres ?, +, [, ], ! are not supported and will be matched literally.'));
|
||||
}
|
||||
// Check for any characters that are illegal in path names in windows
|
||||
if (process.platform === 'win32' && path.match(exports.illegalWindowsCharactersRegex)) {
|
||||
throw new Error('"' + path + '" contains an invalid character. ' +
|
||||
'The characteres <, >, :, ", !, |, ?, * are forbidden to use in paths on windows.');
|
||||
'The filter pattern characters ?, +, [, ], ! are not supported and will be matched literally.'));
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue