Skip to content

Commit c5b3d45

Browse files
committed
try
1 parent 50ad5b7 commit c5b3d45

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

.github/workflows/preview-url-report.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Report Preview URLs
22

33
on:
4-
pull_request:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened]
56
branches: ["develop"]
67
paths:
78
- 'docs/**.rst'
@@ -14,38 +15,43 @@ jobs:
1415
if: github.repository_owner == 'PaddlePaddle'
1516
permissions:
1617
contents: read
17-
issues: write
1818
pull-requests: write
1919

2020
steps:
21-
- name: Checkout repository
21+
- name: Checkout base branch
2222
uses: actions/checkout@v4
2323
with:
24+
ref: ${{ github.event.pull_request.base.sha }}
2425
fetch-depth: 0
2526

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'
2932

3033
- name: Generate comment body
3134
id: generate-comment
3235
run: |
3336
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+
3440
{
3541
echo 'comment_body<<EOF'
36-
./ci_scripts/report_preview_url.sh ${{ github.event.pull_request.number }}
42+
echo "$COMMENT_BODY"
3743
echo EOF
3844
} >> $GITHUB_OUTPUT
3945
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
4248
id: fc
4349
with:
4450
issue-number: ${{ github.event.pull_request.number }}
4551
comment-author: 'github-actions[bot]'
4652
body-includes: '本次 PR 文档预览链接'
4753

48-
- name: Create or Update Comment
54+
- name: Create or update comment
4955
uses: peter-evans/create-or-update-comment@v4
5056
with:
5157
comment-id: ${{ steps.fc.outputs.comment-id }}

0 commit comments

Comments
 (0)