Skip to content

Commit

Permalink
feat: update error handling for yaml inputs (#1395)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
jackton1 and actions-user committed Jul 20, 2023
1 parent bc262c2 commit de0eba3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
11 changes: 5 additions & 6 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
}

Expand Down Expand Up @@ -1164,9 +1164,7 @@ export const hasLocalGitDirectory = async ({
}: {
workingDirectory: string
}): Promise<boolean> => {
const insideWorkTree = await isInsideWorkTree({
return await isInsideWorkTree({
cwd: workingDirectory
})

return insideWorkTree
}

0 comments on commit de0eba3

Please sign in to comment.