Skip to content

Commit 740a856

Browse files
committed
git-artifacts: suggest to validate installer in a PR comment
It is currently a bit cumbersome to find the download link to the installer artifact, and I even missed that it was available for testing already while the `aarch64` stuff was still being built. Let's imitate c99c7f2 (release-git(announcement): add a helpful comment, 2025-03-11) and add a helpful PR comment not only when the release finished, but also when the x86_64 installer was successfully uploaded and is ready for manual testing. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent a7a02f1 commit 740a856

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/git-artifacts.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,47 @@ jobs:
470470
cp /usr/src/build-extra/mingit/root/etc/package-versions.txt artifacts/
471471
- name: Publish ${{matrix.artifact.name}}-${{env.ARCHITECTURE}}
472472
uses: actions/upload-artifact@v4
473+
id: upload-artifact
473474
with:
474475
name: ${{matrix.artifact.name}}-${{env.ARCHITECTURE}}
475476
path: artifacts
477+
- uses: actions/create-github-app-token@v1
478+
if: matrix.artifact.name == 'installer' && github.event.inputs.architecture == 'x86_64'
479+
id: pr-comment-token
480+
with:
481+
app-id: ${{ secrets.GH_APP_ID }}
482+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
483+
owner: ${{ env.OWNER }}
484+
repositories: ${{ env.REPO }}
485+
- name: Add a PR comment suggesting to validate the installer manually
486+
if: matrix.artifact.name == 'installer' && github.event.inputs.architecture == 'x86_64'
487+
uses: actions/github-script@v7
488+
with:
489+
github-token: ${{ steps.pr-comment-token.outputs.token }}
490+
script: |
491+
const installerURL = ${{ toJSON(steps.upload-artifact.outputs.artifact-url) }}
492+
const preFlightChecklistURL = 'https://github.com/git-for-windows/build-extra/blob/HEAD/installer/checklist.txt'
493+
const body = `## Validate the installer manually
494+
495+
The [installer](${installerURL}) was built successfully;
496+
Please download, install, and run through [the pre-flight check-list](${preFlightChecklistURL}).`
497+
498+
const fs = require('fs')
499+
const gitSHA = fs.readFileSync('bundle-artifacts/git-commit-oid')
500+
const q = `repo:${process.env.OWNER}/${process.env.REPO}+is:pr+is:open+${gitSHA}`
501+
const { data } = await github.rest.search.issuesAndPullRequests({ q })
502+
if (data.items.length !== 1) {
503+
core.warning(`${data.items.length} PRs found for ${gitSHA}, not posting a comment, would have posted:\n${body}`)
504+
} else {
505+
const req = {
506+
owner: process.env.OWNER,
507+
repo: process.env.REPO,
508+
issue_number: data.items[0].number,
509+
body: `${body}\n@${data.items[0].user.login} ☝️`,
510+
}
511+
512+
await github.rest.issues.createComment(req)
513+
}
476514
- name: restore check-run state
477515
if: needs.pkg.outputs.check-run-state != '' && always()
478516
id: check-run-state

0 commit comments

Comments
 (0)