Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sheck committed May 11, 2023
1 parent 953dcac commit de23ca7
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const semver = require('semver')
const { easyExec, setOutput } = require('./utils')
const { generateChangeRanges } = require('./git_utils')
const CheckRun = require('./check_run')
const { exec } = require('@actions/exec')

const {
GITHUB_WORKSPACE,
Expand Down Expand Up @@ -165,9 +166,23 @@ async function runEslint () {
}
}

function annotationToOutputCommand(annotation) {
const { path: file, start_line: startLine, end_line: endLine, annotation_level, message } = annotation
switch (annotation_level) {
case "failure":
return core.error(message, { file, startLine, endLine, })
case "warning":
return core.warning(message, { file, startLine, endLine, })
case "":
return core.info(message, { file, startLine, endLine, })
default:
break;
}
}

async function run () {
const checkRun = new CheckRun({ name: checkName, event })
await checkRun.create()
// const checkRun = new CheckRun({ name: checkName, event })
// await checkRun.create()
let report = {}
try {
process.chdir(GITHUB_WORKSPACE)
Expand All @@ -180,7 +195,9 @@ async function run () {
output: { title: checkName, summary: `Balto error: ${e}`, annotations: [] }
}
} finally {
await checkRun.update(report)
// await checkRun.update(report)
report.output.annotations.forEach(annotationToOutputCommand)
// TODO: output exit code //
setOutput("issuesCount", report.output.annotations.length)
}
}
Expand Down

0 comments on commit de23ca7

Please sign in to comment.