Benchmark Comment #18
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: Benchmark Comment | |
| on: | |
| workflow_run: | |
| workflows: [Benchmark] | |
| types: [completed] | |
| jobs: | |
| comment: | |
| name: Post Benchmark Results | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| pull-requests: write | |
| if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' | |
| steps: | |
| - name: Download benchmark artifact | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: benchmark-result | |
| path: benchmark-artifact/ | |
| run-id: ${{ github.event.workflow_run.id }} | |
| github-token: ${{ github.token }} | |
| - name: Read artifact data | |
| id: bench | |
| run: | | |
| echo "pr-number=$(cat benchmark-artifact/pr-number.txt)" >> "$GITHUB_OUTPUT" | |
| echo "head-ref=$(cat benchmark-artifact/head-ref.txt)" >> "$GITHUB_OUTPUT" | |
| echo "base-ref=$(cat benchmark-artifact/base-ref.txt)" >> "$GITHUB_OUTPUT" | |
| echo "base-sha=$(cat benchmark-artifact/base-sha.txt)" >> "$GITHUB_OUTPUT" | |
| echo "head-sha=$(cat benchmark-artifact/head-sha.txt)" >> "$GITHUB_OUTPUT" | |
| { | |
| echo "result<<BENCH_EOF" | |
| cat benchmark-artifact/benchmark-result.txt | |
| echo "BENCH_EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Find existing comment | |
| uses: peter-evans/find-comment@v4 | |
| id: find-comment | |
| with: | |
| issue-number: ${{ steps.bench.outputs.pr-number }} | |
| comment-author: github-actions[bot] | |
| body-includes: "## Benchmark Results" | |
| - name: Post benchmark results | |
| uses: peter-evans/create-or-update-comment@v5 | |
| with: | |
| issue-number: ${{ steps.bench.outputs.pr-number }} | |
| comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
| edit-mode: replace | |
| body: | | |
| ## Benchmark Results | |
| Comparison of `${{ steps.bench.outputs.head-ref }}` against `${{ steps.bench.outputs.base-ref }}` (`${{ steps.bench.outputs.base-sha }}`). | |
| <details> | |
| <summary>Open to see the benchmark results</summary> | |
| ${{ steps.bench.outputs.result }} | |
| </details> | |
| <sub>Generated by phpbench against commit ${{ steps.bench.outputs.head-sha }}</sub> |