-
Notifications
You must be signed in to change notification settings - Fork 90
35 lines (35 loc) · 1.16 KB
/
benchmark-comment.yml
File metadata and controls
35 lines (35 loc) · 1.16 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
name: Post Benchmark Comment
on:
workflow_run:
workflows: ["Benchmarks"]
types: [completed]
jobs:
comment:
name: post benchmark comment
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
permissions:
pull-requests: write
actions: read
steps:
- name: Download benchmark results
uses: actions/download-artifact@v4
with:
name: benchmark-results
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Post comment to PR
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const prNumber = parseInt(fs.readFileSync('pr_number.txt', 'utf8').trim());
const benchResult = fs.readFileSync('benchmark_result.txt', 'utf8');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `## Benchmark Results\n\`\`\`\n${benchResult}\n\`\`\``
});