Skip to content

Commit 005484b

Browse files
authored
#91 - Add PR doc previews (#90)
* Add PR doc previews * fix * try changing branch * fix mapping * Remove md files * Update pr logic * Add flag * Add another exclude * build * Update with concurrency and cancel * lint * lint
1 parent 64ac0fb commit 005484b

File tree

3 files changed

+40
-11
lines changed

3 files changed

+40
-11
lines changed

.github/workflows/docs-deploy.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ jobs:
9393
deploy:
9494
needs: build
9595
runs-on: ubuntu-latest
96-
environment:
97-
name: github-pages
98-
url: ${{ steps.deployment.outputs.page_url }}
9996
steps:
10097
- name: Deploy to GitHub Pages
101-
id: deployment
102-
uses: actions/deploy-pages@v4
98+
uses: JamesIves/github-pages-deploy-action@v4
99+
with:
100+
branch: gh-pages/documentation
101+
folder: docs/public
102+
clean-exclude: |
103+
pr-preview/
104+
.nojekyll
105+
force: false

.github/workflows/pr-checks.yaml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ name: PR Checks
1919
on:
2020
workflow_dispatch:
2121
pull_request:
22+
types: [opened, synchronize, reopened, closed]
2223
branches: [ main ]
2324

25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
27+
cancel-in-progress: true
28+
2429
jobs:
2530
#######################
2631
# Path Filters #
@@ -69,7 +74,8 @@ jobs:
6974
needs: [check-paths]
7075
if: |
7176
(needs.check-paths.outputs.ci == 'true') &&
72-
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true)
77+
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true) &&
78+
(github.event.action != 'closed')
7379
runs-on: ubuntu-latest
7480
steps:
7581
- name: Free disk space
@@ -128,7 +134,8 @@ jobs:
128134
(
129135
needs.check-paths.outputs.ci == 'true' &&
130136
github.event_name == 'pull_request' &&
131-
github.event.pull_request.head.repo.fork == false
137+
github.event.pull_request.head.repo.fork == false &&
138+
github.event.action != 'closed'
132139
)
133140
runs-on: self-hosted
134141
environment:
@@ -193,16 +200,29 @@ jobs:
193200
python-version: '3.10.18'
194201

195202
- name: Install dependencies
203+
if: github.event.action != 'closed'
196204
run: |
197205
pip install -U -r docs/locked_requirements.txt
198206
199207
- name: Build Sphinx documentation
208+
if: github.event.action != 'closed'
200209
run: |
201210
make -C docs build ERR_DIR=build_error_logs OUT_DIR=public
211+
212+
- name: Deploy preview
213+
uses: rossjrw/pr-preview-action@v1
214+
with:
215+
source-dir: ./docs/public/
216+
preview-branch: gh-pages/documentation
217+
218+
- name: Run spelling and linkcheck
219+
if: github.event.action != 'closed'
220+
run: |
202221
make -C docs spelling ERR_DIR=spelling_error_logs OUT_DIR=public
203222
make -C docs linkcheck ERR_DIR=linkcheck_error_logs OUT_DIR=public
204223
205224
- name: Check for build errors
225+
if: github.event.action != 'closed'
206226
run: |
207227
has_spelling_errors=false
208228
has_linkcheck_errors=false
@@ -229,7 +249,7 @@ jobs:
229249
fi
230250
231251
- name: Upload build artifacts
232-
if: always()
252+
if: always() && github.event.action != 'closed'
233253
uses: actions/upload-artifact@v4
234254
with:
235255
name: documentation-build
@@ -245,7 +265,9 @@ jobs:
245265
#######################
246266
ci-docs:
247267
needs: [check-paths]
248-
if: needs.check-paths.outputs.docs == 'true'
268+
if: |
269+
(needs.check-paths.outputs.docs == 'true' && github.event.action != 'closed') ||
270+
github.event_name == 'workflow_dispatch'
249271
runs-on: ubuntu-latest
250272
steps:
251273
- name: Free disk space
@@ -302,7 +324,9 @@ jobs:
302324
#######################
303325
ui-build:
304326
needs: [check-paths]
305-
if: needs.check-paths.outputs.ui == 'true' || github.event_name == 'workflow_dispatch'
327+
if: |
328+
(needs.check-paths.outputs.ui == 'true' && github.event.action != 'closed') ||
329+
github.event_name == 'workflow_dispatch'
306330
runs-on: ubuntu-latest
307331
steps:
308332
- name: Checkout

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
'_extensions.domain_config',
5757
'_extensions.html_translator_mixin',
5858
'_extensions.markdown_translator',
59-
59+
6060
# Theme extension
6161
'_extensions.nvidia_theme_override',
6262
]
@@ -92,6 +92,8 @@
9292

9393
linkcheck_timeout = 150
9494

95+
linkcheck_report_timeouts_as_broken = False
96+
9597
# Copybutton
9698
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
9799
copybutton_prompt_is_regexp = True

0 commit comments

Comments
 (0)