-
-
Notifications
You must be signed in to change notification settings - Fork 161
66 lines (55 loc) · 2.23 KB
/
benchmark-comment.yml
File metadata and controls
66 lines (55 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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>