Skip to content

Commit 28fe054

Browse files
committed
update preview docs
1 parent 23cf57a commit 28fe054

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/docs.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ name: Deploy Sphinx docs to GitHub Pages
33
on:
44
push:
55
branches: [ main, master, docs/pydata ]
6+
pull_request:
7+
types: [opened, synchronize, reopened]
68
workflow_dispatch:
79

810
permissions:
911
contents: read
1012
pages: write
1113
id-token: write
14+
pull-requests: write
1215

1316
concurrency:
14-
group: pages
17+
group: pages-${{ github.ref }}
1518
cancel-in-progress: true
1619

1720
jobs:
@@ -50,3 +53,18 @@ jobs:
5053
id: deployment
5154
uses: actions/deploy-pages@v4
5255

56+
- name: Comment PR with preview URL
57+
if: github.event_name == 'pull_request'
58+
uses: actions/github-script@v7
59+
with:
60+
github-token: ${{ secrets.GITHUB_TOKEN }}
61+
script: |
62+
const previewUrl = `${{ toJSON(steps.deployment.outputs.page_url) }}`;
63+
const issue_number = context.payload.pull_request.number;
64+
await github.rest.issues.createComment({
65+
owner: context.repo.owner,
66+
repo: context.repo.repo,
67+
issue_number,
68+
body: `🔍 Documentation preview for this PR: ${previewUrl}`
69+
});
70+

0 commit comments

Comments
 (0)