Skip to content

Commit f58d5fa

Browse files
committed
Fix updating the queued Check Run in case of failure
When something goes wrong, we want to update the Check Run with enough information to help readers figure out how to fix it. However, we forgot to specify `title` and `summary` and therefore that GitHub REST API call to update the Check Run failed, hiding the original failure. Let's not forget titles and summaries. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 6467476 commit f58d5fa

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

GitForWindowsHelper/slash-commands.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,15 +300,16 @@ module.exports = async (context, req) => {
300300
return `I edited the comment: ${answer2.html_url}`
301301
}
302302

303+
const tagGitCheckRunTitle = `Tag Git @${rev}`
303304
const tagGitCheckRunId = await queueCheckRun(
304305
context,
305306
await getToken(),
306307
owner,
307308
repo,
308309
rev,
309310
'tag-git',
310-
`Tag Git @${rev}`,
311-
`Tag Git @${rev}`
311+
tagGitCheckRunTitle,
312+
tagGitCheckRunTitle
312313
)
313314

314315
try {
@@ -347,6 +348,8 @@ module.exports = async (context, req) => {
347348
status: 'completed',
348349
conclusion: 'failure',
349350
output: {
351+
title: tagGitCheckRunTitle,
352+
summary: tagGitCheckRunTitle,
350353
text: e.message || JSON.stringify(e, null, 2)
351354
}
352355
}
@@ -371,15 +374,17 @@ module.exports = async (context, req) => {
371374
const commitSHA = await getPRCommitSHA(context, await getToken(), owner, repo, issueNumber)
372375

373376
const { listCheckRunsForCommit, queueCheckRun, updateCheckRun } = require('./check-runs')
377+
const checkRunTitle = `Publish Git for Windows @${commitSHA}`
378+
const checkRunSummary = `Downloading the Git artifacts from the 'git-artifacts' runs and publishing them as a new GitHub Release at ${owner}/${repo}`
374379
const releaseCheckRunId = await queueCheckRun(
375380
context,
376381
await getToken(),
377382
'git-for-windows',
378383
repo,
379384
commitSHA,
380385
'github-release',
381-
`Publish Git for Windows @${commitSHA}`,
382-
`Downloading the Git artifacts from the 'git-artifacts' runs and publishing them as a new GitHub Release at ${owner}/${repo}`
386+
checkRunTitle,
387+
checkRunSummary
383388
)
384389

385390
try {
@@ -455,6 +460,8 @@ module.exports = async (context, req) => {
455460
status: 'completed',
456461
conclusion: 'failure',
457462
output: {
463+
title: checkRunTitle,
464+
summary: checkRunSummary,
458465
text: e.message || JSON.stringify(e, null, 2)
459466
}
460467
}

0 commit comments

Comments
 (0)