Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update main.ts
Browse files Browse the repository at this point in the history
lcollins authored May 4, 2024
1 parent a16c5d4 commit 13191e5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ async function run(): Promise<void> {
const path = core.getInput(Inputs.Path, {required: true})
const name = core.getInput(Inputs.Name)
const title = core.getInput(Inputs.Title)
const failOnViolations = core.getBooleanInput(Inputs.FailOnViolation)

const searchResult = await findResults(path)
if (searchResult.filesToUpload.length === 0) {
@@ -41,7 +42,7 @@ async function run(): Promise<void> {
core.debug(`Created ${groupedAnnotations.length} buckets`)

for (const annotationSet of groupedAnnotations) {
await createCheck(name, title, annotationSet, annotations.length)
await createCheck(name, title, annotationSet, annotations.length, failOnViolations)
}
}
} catch (error) {
@@ -53,7 +54,8 @@ async function createCheck(
name: string,
title: string,
annotations: Annotation[],
numErrors: number
numErrors: number,
failOnViolations: boolean
): Promise<void> {
const octokit = getOctokit(core.getInput(Inputs.Token))
let sha = context.sha
@@ -78,7 +80,7 @@ async function createCheck(
head_sha: sha,
name,
status: 'completed' as const,
conclusion: numErrors === 0 ? ('success' as const) : ('neutral' as const),
conclusion: numErrors === 0 ? ('success' as const) : failOnViolations ? ('failure' as const) : ('neutral' as const),
output: {
title,
summary: `${numErrors} violation(s) found`,
@@ -94,7 +96,7 @@ async function createCheck(
...context.repo,
check_run_id,
status: 'completed' as const,
conclusion: numErrors === 0 ? ('success' as const) : ('neutral' as const),
conclusion: numErrors === 0 ? ('success' as const) : failOnViolations ? ('failure' as const) : ('neutral' as const),
output: {
title,
summary: `${numErrors} violation(s) found`,

0 comments on commit 13191e5

Please sign in to comment.