[CI] Add Report Preview URLs Workflow #8
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |