-
-
Notifications
You must be signed in to change notification settings - Fork 116
78 lines (69 loc) · 2.47 KB
/
update-pr.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
# This workflow posts the result of a performance test back to the pull request as a comment.
# Needs to be separate from CI because it has elevated privileges so only runs from main branch.
name: Update PR
on:
workflow_run:
workflows: [ "Performance" ]
types:
- completed
jobs:
updatepr:
runs-on: ubuntu-latest
continue-on-error: true
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
timeout-minutes: 5
steps:
# report status back to pull request
- uses: haya14busa/action-workflow_run-status@v1
- uses: actions/checkout@v4
with:
submodules: true
- name: 'Download branch build info'
uses: dawidd6/action-download-artifact@v6
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: build-info
path: build-info
- name: 'Get build info'
id: build_info
run: echo "::set-output name=pr_number::$(cat build-info/pull_request_number)"
- name: 'Build comment-body'
run: |
cat build-info/branchlogs.txt | sed -n '/^.*Tile stats/,/\tfeatures\t/p' > branchsummary.txt
cat build-info/branchlogs.txt | sed -n '/^.*Exception in thread/,$p' >> branchsummary.txt
cat build-info/branchlogs.txt | grep run.jar >> branchsummary.txt
cat build-info/baselogs.txt | sed -n '/^.*Tile stats/,/\tfeatures\t/p' > basesummary.txt
cat build-info/baselogs.txt | sed -n '/^.*Exception in thread/,$p' >> basesummary.txt
cat build-info/baselogs.txt | grep run.jar >> basesummary.txt
cat << EOF > comment-body.txt
<table>
<thead>
<tr>
<th>This Branch $(cat build-info/branch_sha)</th>
<th>Base $(cat build-info/base_sha)</th>
</tr>
</thead>
<tr>
<td>
\`\`\`
$(cat branchsummary.txt)
\`\`\`
</td>
<td>
\`\`\`
$(cat basesummary.txt)
\`\`\`
</td>
</tr>
</table>
Full logs: https://github.com/onthegomap/planetiler/actions/runs/${{ github.event.workflow_run.id }}
EOF
- name: 'Dump comment body'
run: cat comment-body.txt
- uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
path: comment-body.txt
header: performance-tests
number: ${{ steps.build_info.outputs.pr_number }}