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!`
|
${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) {
|
for (let annotationIndex = 0; annotationIndex < analysisResult.annotations.length; annotationIndex += 50) {
|
||||||
const annotationsSlice = analysisResult.annotations.length > 50 ? analysisResult.annotations.slice(annotationIndex, annotationIndex + 50) : analysisResult.annotations
|
const annotationsSlice = analysisResult.annotations.length > 50 ? analysisResult.annotations.slice(annotationIndex, annotationIndex + 50) : analysisResult.annotations
|
||||||
|
|
||||||
convertAnnotationResults(check, annotationsSlice)
|
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;) {
|
for (let attempts = 3; attempts >= 0;) {
|
||||||
try {
|
try {
|
||||||
const updateResponse = await context.github.checks.update({
|
const updateResponse = await context.github.checks.update({
|
||||||
|
@ -163,12 +176,6 @@ ${Humanize.boundedNumber(failures, 10)} ${Humanize.pluralize(failures, 'failure'
|
||||||
await timeout(30000)
|
await timeout(30000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
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) {
|
async function checkPackageFileAsync (analysisResult: AnalysisResult, context: Context, filename: string, headSHA: string) {
|
||||||
|
|
Loading…
Reference in New Issue