Skip to content

Commit 1924f55

Browse files
committed
upload-snapshot: fail earlier on invalid tag-git Check Runs
When handling a `push` event on `git-for-windows/git`, it is necessary to validate that the `tag-git` Check Run has the information needed to determine the `git-artifacts` runs. If that information is not there (e.g. because `tag-git` was accidentally updated and now contains invalid/unparseable data), we should error out earlier. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 781302e commit 1924f55

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

GitForWindowsHelper/cascading-runs.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,11 @@ const handlePush = async (context, req) => {
339339
`The 'tag-git' run at ${latest.html_url} did not succeed (conclusion = ${latest.conclusion}).`
340340
)
341341

342+
const match = latest.output.summary.match(/^Tag Git (\S+) @([0-9a-f]+)$/)
343+
if (!match) throw new Error(`Unexpected summary '${latest.output.summary}' of tag-git run: ${latest.html_url}`)
344+
if (!match[2] === commit) throw new Error(`Unexpected revision ${match[2]} '${latest.output.summary}' of tag-git run: ${latest.html_url}`)
345+
const ver = match[1]
346+
342347
// There is already a `tag-git` workflow run; Is there already an `upload-snapshot` run?
343348
const latestUploadSnapshotRun = (await listCheckRunsForCommit(
344349
context,
@@ -363,11 +368,6 @@ const handlePush = async (context, req) => {
363368
tagGitCheckRunTitle
364369
)
365370

366-
const match = latest.output.summary.match(/^Tag Git (\S+) @([0-9a-f]+)$/)
367-
if (!match) throw new Error(`Unexpected summary '${latest.output.summary}' of tag-git run: ${latest.html_url}`)
368-
if (!match[2] === commit) throw new Error(`Unexpected revision ${match[2]} '${latest.output.summary}' of tag-git run: ${latest.html_url}`)
369-
const ver = match[1]
370-
371371
try {
372372
const workFlowRunIDs = {}
373373
for (const architecture of ['x86_64', 'i686', 'aarch64']) {

0 commit comments

Comments
 (0)