File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,15 +3,18 @@ name: Deploy Sphinx docs to GitHub Pages
33on :
44 push :
55 branches : [ main, master, docs/pydata ]
6+ pull_request :
7+ types : [opened, synchronize, reopened]
68 workflow_dispatch :
79
810permissions :
911 contents : read
1012 pages : write
1113 id-token : write
14+ pull-requests : write
1215
1316concurrency :
14- group : pages
17+ group : pages-${{ github.ref }}
1518 cancel-in-progress : true
1619
1720jobs :
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+
You can’t perform that action at this time.
0 commit comments