Skip to content

Commit

Permalink
Stop processing if file is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Oct 23, 2020
1 parent fad0bc6 commit ec14845
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ const readAnnotationsFile= async function(inputPath) {
} catch (err) {
if (err.code === 'ENOENT' && ignoreMissingFile) {
core.info(`Ignoring missing file at '${inputPath}' because \'ignore-missing-file\' is true`)
return null
} else {
throw err
}
Expand All @@ -416,6 +417,9 @@ async function run () {
const repo = github.context.repo.repo

const annotations = await readAnnotationsFile(inputPath)
if (annotations === null) {
return
}
const checkRunId = await createCheck(octokit, owner, repo, title, ref)
const { failureCount, warningCount, noticeCount } = stats(annotations)
core.info(`Found ${failureCount} failure(s), ${warningCount} warning(s) and ${noticeCount} notice(s)`)
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const readAnnotationsFile= async function(inputPath) {
} catch (err) {
if (err.code === 'ENOENT' && ignoreMissingFile) {
core.info(`Ignoring missing file at '${inputPath}' because \'ignore-missing-file\' is true`)
return null
} else {
throw err
}
Expand All @@ -143,6 +144,9 @@ async function run () {
const repo = github.context.repo.repo

const annotations = await readAnnotationsFile(inputPath)
if (annotations === null) {
return
}
const checkRunId = await createCheck(octokit, owner, repo, title, ref)
const { failureCount, warningCount, noticeCount } = stats(annotations)
core.info(`Found ${failureCount} failure(s), ${warningCount} warning(s) and ${noticeCount} notice(s)`)
Expand Down

0 comments on commit ec14845

Please sign in to comment.