1
1
name : Report Preview URLs
2
2
3
3
on :
4
- pull_request :
4
+ pull_request_target :
5
+ types : [opened, synchronize, reopened]
5
6
branches : ["develop"]
6
7
paths :
7
8
- ' docs/**.rst'
@@ -14,38 +15,43 @@ jobs:
14
15
if : github.repository_owner == 'PaddlePaddle'
15
16
permissions :
16
17
contents : read
17
- issues : write
18
18
pull-requests : write
19
19
20
20
steps :
21
- - name : Checkout repository
21
+ - name : Checkout base branch
22
22
uses : actions/checkout@v4
23
23
with :
24
+ ref : ${{ github.event.pull_request.base.sha }}
24
25
fetch-depth : 0
25
26
26
- - name : Fetch base branch
27
- run : |
28
- git fetch origin develop:develop
27
+ - name : Checkout PR head branch
28
+ uses : actions/checkout@v4
29
+ with :
30
+ ref : ${{ github.event.pull_request.head.sha }}
31
+ path : ' pr_head'
29
32
30
33
- name : Generate comment body
31
34
id : generate-comment
32
35
run : |
33
36
chmod +x ci_scripts/report_preview_url.sh
37
+
38
+ COMMENT_BODY=$(cd pr_head && ../ci_scripts/report_preview_url.sh ${{ github.event.pull_request.number }})
39
+
34
40
{
35
41
echo 'comment_body<<EOF'
36
- ./ci_scripts/report_preview_url.sh ${{ github.event.pull_request.number }}
42
+ echo "$COMMENT_BODY"
37
43
echo EOF
38
44
} >> $GITHUB_OUTPUT
39
45
40
- - name : Post or Update Comment
41
- uses : peter-evans/find-comment@v4
46
+ - name : Find previous comment
47
+ uses : peter-evans/find-comment@v3
42
48
id : fc
43
49
with :
44
50
issue-number : ${{ github.event.pull_request.number }}
45
51
comment-author : ' github-actions[bot]'
46
52
body-includes : ' 本次 PR 文档预览链接'
47
53
48
- - name : Create or Update Comment
54
+ - name : Create or update comment
49
55
uses : peter-evans/create-or-update-comment@v4
50
56
with :
51
57
comment-id : ${{ steps.fc.outputs.comment-id }}
0 commit comments