Fix bot not updating check run if there are no annotations
This commit is contained in:
parent
0653b8f8e3
commit
dab5d6aa94
19
src/index.ts
19
src/index.ts
|
@ -133,11 +133,24 @@ async function queueCheckAsync (context: Context, checkSuite: Octokit.ChecksCrea
|
|||
${Humanize.boundedNumber(failures, 10)} ${Humanize.pluralize(failures, 'failure')}, ${Humanize.boundedNumber(warnings, 10)} ${Humanize.pluralize(warnings, 'warning')} in ${Humanize.oxford(uniqueProblemDependencies.map(f => `\`${f}\``), 3)} need your attention!`
|
||||
}
|
||||
|
||||
if (analysisResult.annotations.length === 0) {
|
||||
await updateRunAsync(context, check)
|
||||
} else {
|
||||
for (let annotationIndex = 0; annotationIndex < analysisResult.annotations.length; annotationIndex += 50) {
|
||||
const annotationsSlice = analysisResult.annotations.length > 50 ? analysisResult.annotations.slice(annotationIndex, annotationIndex + 50) : analysisResult.annotations
|
||||
|
||||
convertAnnotationResults(check, annotationsSlice)
|
||||
await updateRunAsync(context, check)
|
||||
}
|
||||
}
|
||||
delete pendingChecks[head_sha]
|
||||
} catch (error) {
|
||||
context.log.error(error)
|
||||
// This function isn't usually awaited for, so there's no point in rethrowing
|
||||
}
|
||||
}
|
||||
|
||||
async function updateRunAsync(context: Context, check: Octokit.ChecksUpdateParams) {
|
||||
for (let attempts = 3; attempts >= 0;) {
|
||||
try {
|
||||
const updateResponse = await context.github.checks.update({
|
||||
|
@ -164,12 +177,6 @@ ${Humanize.boundedNumber(failures, 10)} ${Humanize.pluralize(failures, 'failure'
|
|||
}
|
||||
}
|
||||
}
|
||||
delete pendingChecks[head_sha]
|
||||
} catch (error) {
|
||||
context.log.error(error)
|
||||
// This function isn't usually awaited for, so there's no point in rethrowing
|
||||
}
|
||||
}
|
||||
|
||||
async function checkPackageFileAsync (analysisResult: AnalysisResult, context: Context, filename: string, headSHA: string) {
|
||||
const contentsResponse: any = await context.github.repos.getContents(context.repo({
|
||||
|
|
Loading…
Reference in New Issue