.github/workflows/pr-comment.yml #1452
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
| on: | |
| workflow_run: | |
| workflows: ["Test Suite"] | |
| types: | |
| - completed | |
| jobs: | |
| pr-comment: | |
| runs-on: ubuntu-latest | |
| if: > | |
| github.event.workflow_run.event == 'pull_request' && | |
| github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - name: "Check if benchmark artifacts exist" | |
| id: check_artifacts | |
| run: | | |
| # The workflow will continue even if artifacts don't exist | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| - name: Download pull request id artifact | |
| uses: dawidd6/action-download-artifact@v11 | |
| with: | |
| run_id: ${{ github.event.workflow_run.id }} | |
| name: pr | |
| path: ./var/phpbench/pr | |
| - name: Save PR id | |
| id: pr | |
| run: | | |
| echo "id=$(<./var/phpbench/pr/pr-id.txt)" >> $GITHUB_OUTPUT | |
| - name: Download phpbench benchmarks artifact | |
| uses: dawidd6/action-download-artifact@v11 | |
| with: | |
| run_id: ${{ github.event.workflow_run.id }} | |
| name: phpbench | |
| path: ./var/phpbench/summary/ | |
| - name: Get benchmarks output | |
| id: get-benchmarks | |
| run: | | |
| echo "content<<EOF" >> $GITHUB_OUTPUT | |
| echo "$(cat ./var/phpbench/summary/summary.txt)" >> $GITHUB_OUTPUT | |
| echo EOF >> $GITHUB_OUTPUT | |
| - name: Find comment | |
| uses: peter-evans/find-comment@v4 | |
| id: fc | |
| with: | |
| issue-number: ${{ steps.pr.outputs.id }} | |
| comment-author: 'github-actions[bot]' | |
| body-includes: '# Flow PHP - Benchmarks' | |
| - name: Create or update comment | |
| uses: peter-evans/create-or-update-comment@v5 | |
| with: | |
| comment-id: ${{ steps.fc.outputs.comment-id }} | |
| issue-number: ${{ steps.pr.outputs.id }} | |
| body: ${{ steps.get-benchmarks.outputs.content }} | |
| edit-mode: replace |