forked from aave-dao/aave-v3-origin
-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (65 loc) · 2.47 KB
/
comment.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
name: PR Comment
on:
workflow_run:
workflows: [Test]
types:
- completed
permissions:
actions: read
issues: write
checks: read
statuses: read
pull-requests: write
jobs:
comment:
name: Comment Bot
runs-on: ubuntu-latest
# workflow run triggeres on all types of "completed" including "cancelled" and similar
# we want this action to only run on a success & failure though
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure' }}
steps:
- uses: actions/download-artifact@v4
with:
name: pr_number
path: pr/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
- name: Read pr number
id: get_pr_number
run: echo "pr_number=$(cat pr/pr_number.txt)" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
name: ${{ github.event.workflow_run.head_sha }}
path: tmp/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
- name: Find Comment
uses: peter-evans/find-comment@782f37b1a8a2b3e2eb9e86a994f0871e9dc146e3
id: fc
if: ${{ steps.get_pr_number.outputs.pr_number != null }}
with:
issue-number: ${{ steps.get_pr_number.outputs.pr_number }}
comment-author: "github-actions[bot]"
body-includes: Foundry report
- name: Create or update pr comment
uses: peter-evans/create-or-update-comment@48bb05bd5554c378187694936d277d48652922e7
if: ${{ steps.get_pr_number.outputs.pr_number != null }}
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ steps.get_pr_number.outputs.pr_number }}
body-file: tmp/template.md
edit-mode: replace
- id: get-comment-body
if: ${{ steps.get_pr_number.outputs.pr_number == null }}
run: |
body="$(cat tmp/template.md)"
delimiter="$(openssl rand -hex 8)"
echo "body<<$delimiter" >> $GITHUB_OUTPUT
echo "$body" >> $GITHUB_OUTPUT
echo "$delimiter" >> $GITHUB_OUTPUT
- name: Create or update commit comment
uses: peter-evans/commit-comment@ae7c3825ead23dab7a1ad8cd4df9617ab4bf0b37
if: ${{ steps.get_pr_number.outputs.pr_number == null }}
with:
sha: ${{ github.event.workflow_run.head_sha }}
body: ${{ steps.get-comment-body.outputs.body }}