Skip to content

Commit 961ebdb

Browse files
committed
/release: pass the git-artifacts _workflow_ runs
Since we mirror Check Runs into a different repository, it _can_ be quite confusing which ID is required. But for the `release-git` workflow it is clear: it needs the artifacts which are attached to the `git-artifacts` workflow runs. But we have the Check Run only. But then, the `output.text` attribute has a link to the workflow, from which we can easily determine the workflow run ID. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent f58d5fa commit 961ebdb

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

GitForWindowsHelper/slash-commands.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,16 @@ module.exports = async (context, req) => {
409409
if (latest.status !== 'completed' || latest.conclusion !== 'success') {
410410
throw new Error(`The '${workflowName}}' run at ${latest.html_url} did not succeed.`)
411411
}
412-
workFlowRunIDs[architecture] = latest.id
412+
413+
const match = latest.output.text.match(/For details, see \[this run\]\(https:\/\/github.com\/([^/]+)\/([^/]+)\/actions\/runs\/(\d+)\)/)
414+
if (!match) throw new Error(`Unhandled 'text' attribute of git-artifacts run ${latest.id}: ${latest.url}`)
415+
const owner = match[1]
416+
const repo = match[2]
417+
workFlowRunIDs[architecture] = match[3]
418+
if (owner !== 'git-for-windows' || repo !== 'git-for-windows-automation') {
419+
throw new Error(`Unexpected repository ${owner}/${repo} for git-artifacts run ${latest.id}: ${latest.url}`)
420+
}
421+
413422
const gitVersionMatch = latest.output.summary.match(/^Build Git (\S+) artifacts from commit (\S+) \(tag-git run #(\d+)\)$/)
414423
if (!gitVersionMatch) throw new Error(`Could not parse summary '${latest.output.summary}' of run ${latest.id}`)
415424
if (!gitVersion) gitVersion = gitVersionMatch[1]

0 commit comments

Comments
 (0)