pull request build result comment #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: pull request build result comment | ||
| on: | ||
| workflow_run: | ||
| workflows: [build] | ||
| types: [completed] | ||
| jobs: | ||
| success: | ||
| if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - id: getUrls | ||
| name: get URLs | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const result = {}; | ||
| const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| run_id: context.payload.workflow_run.id, | ||
| }); | ||
| for (const artifact of artifacts) { | ||
| if (artifact.name.startsWith("osara_windows")) { | ||
| result.windows = artifact.archive_download_url; | ||
| } else if (artifact.name.startsWith("osara_mac")) { | ||
| result.mac = artifact.archive_download_url; | ||
| } | ||
| } | ||
| return result; | ||
| - name: comment | ||
| uses: thollander/actions-comment-pull-request@v3 | ||
| with: | ||
| message: | | ||
|
Check failure on line 33 in .github/workflows/prBuildResultComment.yml
|
||
| [Build succeeded!](https://github.com/jcsteh/osara/actions/runs/${{ github.event.workflow_run.id }}) | ||
| - [Download for Windows](${{ steps.getUrls.outputs.windows) | ||
| - [Download for Mac](${{ steps.getUrls.outputs.mac) | ||
| failure: | ||
| if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: comment | ||
| uses: thollander/actions-comment-pull-request@v3 | ||
| with: | ||
| message: | | ||
| [Build failed!](https://github.com/jcsteh/osara/actions/runs/${{ github.event.workflow_run.id }}) | ||