-
Notifications
You must be signed in to change notification settings - Fork 75
65 lines (56 loc) · 1.83 KB
/
comment-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
name: comment-pr
on:
workflow_run:
workflows: ["sv-tests-ci"]
types:
- completed
jobs:
Comment:
permissions:
pull-requests: write
name: Comment
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: ubuntu:jammy-20221130
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Install dependencies
run: |
apt-get update -qq
apt install -y unzip
- uses: actions/download-artifact@v4
with:
name: tests_summary
- name: Unpack artifacts
run: |
unzip tests_summary.zip
cat ./tests_summary.md
- name: Generate and append artifacts link
run: |
SUITE_ID=$(cat ./suite_id)
ARTIFACT_URL="https://github.com/chipsalliance/sv-tests/suites/$SUITE_ID"
MD_URL="[Download an archive containing all the details]($ARTIFACT_URL)"
echo -e "\n\n$MD_URL" >> tests_summary.md
- name: Show summary
run: |
cat tests_summary.md > $GITHUB_STEP_SUMMARY
- name: Prepare comment
id: get-comment-body
run: |
body=$(cat ./tests_summary.md)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Get PR number
id: get-pr-number
run: |
num=$(cat ./issue_num)
echo ::set-output name=num::$num
- name: Post comment
uses: KeisukeYamashita/create-comment@v1
with:
number: ${{ steps.get-pr-number.outputs.num }}
check-only-first-line: "true"
unique: "true"
token: ${{ secrets.GITHUB_TOKEN }}
comment: ${{ steps.get-comment-body.outputs.body }}