PR Report #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: PR Report | |
| on: | |
| workflow_run: | |
| workflows: ["build"] | |
| types: [completed] | |
| jobs: | |
| reporting: | |
| name: "Pull Request Report" | |
| # Only run for pull requests targeting master (not push/dispatch runs) | |
| if: > | |
| github.event.workflow_run.event == 'pull_request' && | |
| github.event.workflow_run.head_branch != 'master' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| actions: read | |
| steps: | |
| # Download Ink Proof Results from the triggering workflow run | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: result-* | |
| path: "results" | |
| merge-multiple: true | |
| run-id: ${{ github.event.workflow_run.id }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| # Retrieve the PR number from the workflow run | |
| - name: Get PR number | |
| id: get-pr | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const prs = await github.rest.pulls.list({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| state: 'open', | |
| head: `${context.payload.workflow_run.head_repository.owner.login}:${context.payload.workflow_run.head_branch}` | |
| }); | |
| if (prs.data.length === 0) { | |
| core.setFailed('No matching open PR found'); | |
| return; | |
| } | |
| core.setOutput('pr_number', prs.data[0].number); | |
| # Create comment text | |
| - name: Create Comment Text File | |
| shell: bash | |
| run: | | |
| echo "### Ink Proof Results" >> comment.txt | |
| echo "" >> comment.txt | |
| echo "These results are obtained by running the [Ink-Proof Testing Suite](https://github.com/chromy/ink-proof) on the compiled binaries in this pull request." >> comment.txt | |
| echo "" >> comment.txt | |
| echo "| System | Results |" >> comment.txt | |
| echo "| --- | --- |" >> comment.txt | |
| FILES="results/*.txt" | |
| for f in $FILES | |
| do | |
| echo "Reading results from $f" | |
| cat "$f" >> comment.txt | |
| done | |
| # Post Comment | |
| - uses: marocchino/[email protected] | |
| with: | |
| recreate: true | |
| number: ${{ steps.get-pr.outputs.pr_number }} | |
| path: comment.txt |