forked from awesome-mlss/awesome-mlss
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.41 KB
/
post-pr-preview.yml
File metadata and controls
52 lines (45 loc) · 1.41 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Post README preview comment
on:
workflow_run:
workflows: ['README preview (PR)']
types: [completed]
permissions:
pull-requests: write
jobs:
post-comment:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download preview artifact
uses: actions/download-artifact@v4
with:
name: readme-preview
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
path: ./preview
- name: Read PR number
id: pr
run: |
number=$(cat ./preview/pr-number.txt)
echo "number=$number" >> "$GITHUB_OUTPUT"
- name: Read preview body
id: body
run: |
{
echo 'body<<PREVIEW_EOF'
cat ./preview/preview.md
echo 'PREVIEW_EOF'
} >> "$GITHUB_OUTPUT"
- name: Find existing preview comment
uses: peter-evans/find-comment@v3
id: find
with:
issue-number: ${{ steps.pr.outputs.number }}
body-includes: '<!-- readme-preview-bot -->'
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.pr.outputs.number }}
comment-id: ${{ steps.find.outputs.comment-id }}
body: ${{ steps.body.outputs.body }}
edit-mode: replace