feat: update error handling for yaml inputs (#1395)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
bc262c2f61
commit
de0eba3279
11
dist/index.js
generated
vendored
11
dist/index.js
generated
vendored
@ -2201,18 +2201,18 @@ const getYamlFilePatternsFromContents = ({ content = '', filePath = '', excluded
|
||||
const doc = (0, yaml_1.parseDocument)(source, { merge: true, schema: 'failsafe' });
|
||||
if (doc.errors.length > 0) {
|
||||
if (filePath) {
|
||||
core.warning(`YAML errors in ${filePath}: ${doc.errors}`);
|
||||
throw new Error(`YAML errors in ${filePath}: ${doc.errors}`);
|
||||
}
|
||||
else {
|
||||
core.warning(`YAML errors: ${doc.errors}`);
|
||||
throw new Error(`YAML errors: ${doc.errors}`);
|
||||
}
|
||||
}
|
||||
if (doc.warnings.length > 0) {
|
||||
if (filePath) {
|
||||
core.warning(`YAML warnings in ${filePath}: ${doc.warnings}`);
|
||||
throw new Error(`YAML warnings in ${filePath}: ${doc.warnings}`);
|
||||
}
|
||||
else {
|
||||
core.warning(`YAML warnings: ${doc.warnings}`);
|
||||
throw new Error(`YAML warnings: ${doc.warnings}`);
|
||||
}
|
||||
}
|
||||
const yamlObject = doc.toJS();
|
||||
@ -2367,10 +2367,9 @@ const recoverDeletedFiles = ({ inputs, workingDirectory, deletedFiles, recoverPa
|
||||
});
|
||||
exports.recoverDeletedFiles = recoverDeletedFiles;
|
||||
const hasLocalGitDirectory = ({ workingDirectory }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const insideWorkTree = yield (0, exports.isInsideWorkTree)({
|
||||
return yield (0, exports.isInsideWorkTree)({
|
||||
cwd: workingDirectory
|
||||
});
|
||||
return insideWorkTree;
|
||||
});
|
||||
exports.hasLocalGitDirectory = hasLocalGitDirectory;
|
||||
|
||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
12
src/utils.ts
12
src/utils.ts
@ -893,17 +893,17 @@ const getYamlFilePatternsFromContents = async ({
|
||||
|
||||
if (doc.errors.length > 0) {
|
||||
if (filePath) {
|
||||
core.warning(`YAML errors in ${filePath}: ${doc.errors}`)
|
||||
throw new Error(`YAML errors in ${filePath}: ${doc.errors}`)
|
||||
} else {
|
||||
core.warning(`YAML errors: ${doc.errors}`)
|
||||
throw new Error(`YAML errors: ${doc.errors}`)
|
||||
}
|
||||
}
|
||||
|
||||
if (doc.warnings.length > 0) {
|
||||
if (filePath) {
|
||||
core.warning(`YAML warnings in ${filePath}: ${doc.warnings}`)
|
||||
throw new Error(`YAML warnings in ${filePath}: ${doc.warnings}`)
|
||||
} else {
|
||||
core.warning(`YAML warnings: ${doc.warnings}`)
|
||||
throw new Error(`YAML warnings: ${doc.warnings}`)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1164,9 +1164,7 @@ export const hasLocalGitDirectory = async ({
|
||||
}: {
|
||||
workingDirectory: string
|
||||
}): Promise<boolean> => {
|
||||
const insideWorkTree = await isInsideWorkTree({
|
||||
return await isInsideWorkTree({
|
||||
cwd: workingDirectory
|
||||
})
|
||||
|
||||
return insideWorkTree
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user