-
Notifications
You must be signed in to change notification settings - Fork 38
49 lines (43 loc) · 1.8 KB
/
Copy pathbenchmark-comment.yml
File metadata and controls
49 lines (43 loc) · 1.8 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
name: Benchmark Comment
on:
workflow_run:
workflows: [CI, Benchmark On Demand]
types: [completed]
jobs:
comment:
if: >
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event != 'push'
runs-on: ubuntu-latest
permissions:
actions: read
pull-requests: write
steps:
- name: Download benchmark result
uses: actions/download-artifact@v4
with:
name: benchmark-result
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
run: |
echo "number=$(sed -n '1p' benchmark-result.md)" >> "$GITHUB_OUTPUT"
echo "heading=$(sed -n '2p' benchmark-result.md)" >> "$GITHUB_OUTPUT"
tail -n +2 benchmark-result.md > benchmark-comment.md
echo "" >> benchmark-comment.md
echo "<sub>To run a specific benchmark, comment <code>/benchmark <name></code><br><code>attributes</code>, <code>aware</code>, <code>class</code>, <code>default</code>, <code>forwarding</code>, <code>merge</code>, <code>named-slots</code>, <code>no-attributes</code>, <code>slot</code>, <code>compilation</code></sub>" >> benchmark-comment.md
- name: Find existing comment
uses: peter-evans/find-comment@v3
id: find
with:
issue-number: ${{ steps.meta.outputs.number }}
comment-author: 'github-actions[bot]'
body-includes: '${{ steps.meta.outputs.heading }}'
- name: Post or update comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.meta.outputs.number }}
comment-id: ${{ steps.find.outputs.comment-id }}
edit-mode: replace
body-path: benchmark-comment.md