Skip to content

[CI] Add Report Preview URLs Workflow #9

[CI] Add Report Preview URLs Workflow

[CI] Add Report Preview URLs Workflow #9

name: Report Preview URLs
on:
pull_request:
branches: ["develop"]
paths:
- 'docs/**.rst'
- 'docs/**.md'
jobs:
report-urls:
name: Report Preview URLs
runs-on: ubuntu-latest
# if: github.repository_owner == 'PaddlePaddle'
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch base branch
run: |
git fetch origin develop:develop
- name: Generate comment body
id: generate-comment
run: |
chmod +x ci_scripts/report_preview_url.sh
{
echo 'comment_body<<EOF'
./ci_scripts/report_preview_url.sh ${{ github.event.pull_request.number }}
echo EOF
} >> $GITHUB_OUTPUT
- name: Post or Update Comment
uses: peter-evans/find-comment@v4
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '本次 PR 文档预览链接'
- name: Create or Update Comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.generate-comment.outputs.comment_body }}
edit-mode: replace