-
Notifications
You must be signed in to change notification settings - Fork 29
93 lines (79 loc) · 3.05 KB
/
comment_benchmarks_v2.yml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Process Benchmark Results V2
on:
workflow_run:
workflows:
- "CI v2"
types:
- completed
jobs:
process_benchmarks:
runs-on: ubuntu-latest
if: github.repository_owner == 'victimsnino' && github.event.workflow_run.conclusion == 'success'
steps:
- uses: haya14busa/action-workflow_run-status@main
- name: "Get PR information"
uses: potiuk/get-workflow-origin@v1_3
id: source-run-info
with:
token: ${{ secrets.GITHUB_TOKEN }}
sourceRunId: ${{ github.event.workflow_run.id }}
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
repository: ${{ github.event.workflow_run.head_repository.full_name }}
ref: ${{ github.event.workflow_run.head_branch }}
- name: Download all workflow run artifacts
uses: dawidd6/action-download-artifact@v6
with:
github_token: ${{secrets.GITHUB_TOKEN}}
path: artifacts
run_id: ${{github.event.workflow_run.id}}
- uses: actions/checkout@v4
with:
ref: gh-pages
token: ${{ secrets.GITHUB_TOKEN }}
path: gh-pages
- name: Process benchmarks
run: |
python3 ${{github.workspace}}/ci/process_benchmark_data.py ${{ github.event.workflow_run.head_sha }} "${{github.event.workflow_run.head_commit.message}}" > comment-body.txt
body="$(cat comment-body.txt)"
delimiter="$(openssl rand -hex 8)"
echo "body<<$delimiter" >> $GITHUB_OUTPUT
echo "$body" >> $GITHUB_OUTPUT
echo "$delimiter" >> $GITHUB_OUTPUT
id: results
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
if: github.event.workflow_run.event == 'pull_request'
with:
issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
comment-author: 'github-actions[bot]'
body-includes: BENCHMARK RESULTS (AUTOGENERATED)
- name: Create comment
if: github.event.workflow_run.event == 'push'
uses: peter-evans/commit-comment@v3
with:
sha: ${{ github.event.workflow_run.head_sha }}
body: ${{ steps.results.outputs.body }}
- name: Update comment
uses: peter-evans/create-or-update-comment@v4
if: github.event.workflow_run.event == 'pull_request'
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
body: ${{ steps.results.outputs.body }}
edit-mode: replace
- name: Upload html
uses: actions/upload-artifact@v4
if: github.event.workflow_run.event == 'push'
with:
name: benchmark.html
path: ./gh-pages/v2/benchmark_results.json
- name: Deploy to github pages
uses: peaceiris/actions-gh-pages@v4
if: github.event.workflow_run.event == 'push'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages