Skip to content

Commit 2ad8009

Browse files
committed
/git-artifacts: do queue the tag-git check run early
It is good practice to provide some visual feedback as quickly as possible when something succeeded (or failed). Let's do this when triggering the `tag-git` workflow, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent cb22a14 commit 2ad8009

1 file changed

Lines changed: 49 additions & 21 deletions

File tree

GitForWindowsHelper/slash-commands.js

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ module.exports = async (context, req) => {
270270
const { getPRCommitSHA } = require('./issues')
271271
const rev = await getPRCommitSHA(context, await getToken(), owner, repo, issueNumber)
272272

273-
const { listCheckRunsForCommit } = require('./check-runs')
273+
const { listCheckRunsForCommit, queueCheckRun, updateCheckRun } = require('./check-runs')
274274
const runs = await listCheckRunsForCommit(
275275
context,
276276
await getToken(owner, repo),
@@ -300,31 +300,59 @@ module.exports = async (context, req) => {
300300
return `I edited the comment: ${answer2.html_url}`
301301
}
302302

303-
const triggerWorkflowDispatch = require('./trigger-workflow-dispatch')
304-
const answer = await triggerWorkflowDispatch(
305-
context,
306-
await getToken(),
307-
'git-for-windows',
308-
'git-for-windows-automation',
309-
'tag-git.yml',
310-
'main', {
311-
rev,
312-
owner,
313-
repo,
314-
snapshot: 'false'
315-
}
316-
)
317-
318-
const { appendToIssueComment } = require('./issues')
319-
const answer2 = await appendToIssueComment(
303+
const tagGitCheckRunId = await queueCheckRun(
320304
context,
321305
await getToken(),
322306
owner,
323307
repo,
324-
commentId,
325-
`The \`tag-git\` workflow run [was started](${answer.html_url})`
308+
rev,
309+
'tag-git',
310+
`Tag Git @${rev}`,
311+
`Tag Git @${rev}`
326312
)
327-
return `I edited the comment: ${answer2.html_url}`
313+
314+
try {
315+
const triggerWorkflowDispatch = require('./trigger-workflow-dispatch')
316+
const answer = await triggerWorkflowDispatch(
317+
context,
318+
await getToken(),
319+
'git-for-windows',
320+
'git-for-windows-automation',
321+
'tag-git.yml',
322+
'main', {
323+
rev,
324+
owner,
325+
repo,
326+
snapshot: 'false'
327+
}
328+
)
329+
330+
const { appendToIssueComment } = require('./issues')
331+
const answer2 = await appendToIssueComment(
332+
context,
333+
await getToken(),
334+
owner,
335+
repo,
336+
commentId,
337+
`The \`tag-git\` workflow run [was started](${answer.html_url})`
338+
)
339+
return `I edited the comment: ${answer2.html_url}`
340+
} catch (e) {
341+
await updateCheckRun(
342+
context,
343+
await getToken(),
344+
owner,
345+
repo,
346+
tagGitCheckRunId, {
347+
status: 'completed',
348+
conclusion: 'failure',
349+
output: {
350+
text: e.toString()
351+
}
352+
}
353+
)
354+
throw e
355+
}
328356
}
329357

330358
if (command == '/release') {

0 commit comments

Comments
 (0)