name: Write build artifact comments on: workflow_run: workflows: [🪟 MingW64 Windows 64bit Build] types: - completed jobs: on-success: runs-on: ubuntu-latest steps: - name: 'Download artifact' id: download_artifact uses: actions/github-script@v7 with: script: | let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, run_id: context.payload.workflow_run.id, }); let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => { return artifact.name == "QGIS for Windows 64bit" }); if (matchArtifacts.length>0) { let download = await github.rest.actions.downloadArtifact({ owner: context.repo.owner, repo: context.repo.repo, artifact_id: matchArtifacts[0].id, archive_format: 'zip', }); let fs = require('fs'); fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/QGIS for Windows 64bit.zip`, Buffer.from(download.data)); core.setOutput('artifact_id', matchArtifacts[0].id); } else { core.setOutput('artifact_id', 0); } - name: 'Unzip artifact' if: fromJSON(steps.download_artifact.outputs.artifact_id) > 0 run: | unzip "QGIS for Windows 64bit.zip" unzip qgis-portable-win64.zip - name: 'Post artifact download link as comment on PR' if: fromJSON(steps.download_artifact.outputs.artifact_id) > 0 uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | let fs = require('fs'); let issue_number = Number(fs.readFileSync('./pr_number')); let body = "## 🪟 Windows builds ready!\n\n" + "Windows builds of this PR are available for testing [here](https://github.com/qgis/QGIS/suites/" + context.payload.workflow_run.check_suite_id + "/artifacts/${{steps.download_artifact.outputs.artifact_id}})."; await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue_number, body: body });