From f30871a4b53a7bf38b4bcee2a2618b3322021811 Mon Sep 17 00:00:00 2001 From: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com> Date: Tue, 21 Apr 2026 11:52:11 -0700 Subject: [PATCH 1/3] fix: prevent gh-pages repo bloat from doc preview artifacts (nvbug 6099503) - Pass `-d /tmp/doctrees` to sphinx-build so .doctrees/ cache is never written into build/html and never uploaded to gh-pages - Add `paths` filter to pull_request trigger so the docs workflow only runs on PRs touching docs/** or modelopt/** - Set `single-commit: true` on JamesIves deploy action so main-site pushes squash into one commit instead of accumulating forever - Deduplicate docs build: deploy-preview now downloads the artifact produced by build-docs instead of running a second sphinx-build - Set retention-days: 1 on the artifact since it is only needed for the duration of the workflow run Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com> --- .github/workflows/pages.yml | 22 +++++++++++++++------- noxfile.py | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 43e2b5cc78d..919cacfcd96 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -4,6 +4,9 @@ on: pull_request: types: [opened, synchronize, reopened, closed] branches: [main, release/*, feature/*] + paths: + - "docs/**" + - "modelopt/**" push: branches: [main] schedule: @@ -23,33 +26,37 @@ permissions: jobs: build-docs: + if: github.event.action != 'closed' runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 10 steps: - uses: actions/checkout@v6 - uses: ./.github/actions/ubuntu-setup - name: Build docs run: pip install nox uv && nox -s docs - name: Upload docs artifact - if: github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' uses: actions/upload-artifact@v4 with: name: docs-html path: docs/build/html + retention-days: 1 deploy-preview: - if: github.event_name == 'pull_request' + if: always() && github.event_name == 'pull_request' + needs: build-docs runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 10 # Per-PR concurrency without cancel-in-progress so 'closed' cleanup always runs concurrency: group: pr-preview-${{ github.event.pull_request.number }} steps: - uses: actions/checkout@v6 - - uses: ./.github/actions/ubuntu-setup - - name: Build docs + - name: Download docs artifact if: github.event.action != 'closed' - run: pip install nox uv && nox -s docs + uses: actions/download-artifact@v4 + with: + name: docs-html + path: docs/build/html - name: Deploy / remove PR preview uses: rossjrw/pr-preview-action@v1 with: @@ -70,5 +77,6 @@ jobs: uses: JamesIves/github-pages-deploy-action@v4 with: folder: docs/build/html + single-commit: true # Preserve PR preview subdirectories deployed by the deploy-preview job clean-exclude: pr-preview diff --git a/noxfile.py b/noxfile.py index fcef3d30875..96db23e1eee 100644 --- a/noxfile.py +++ b/noxfile.py @@ -164,6 +164,8 @@ def docs(session): with session.chdir("docs"): session.run( "sphinx-build", + "-d", + "/tmp/doctrees", "source", "build/html", "--fail-on-warning", From 6d16719c42f4651046ee14825b92a0050ec58980 Mon Sep 17 00:00:00 2001 From: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com> Date: Tue, 21 Apr 2026 12:07:33 -0700 Subject: [PATCH 2/3] fix: add pages.yml to PR paths filter so workflow changes trigger CI Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com> --- .github/workflows/pages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 919cacfcd96..f4b86fb56a9 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -7,6 +7,7 @@ on: paths: - "docs/**" - "modelopt/**" + - ".github/workflows/pages.yml" push: branches: [main] schedule: From 77f3432299e53eb3d82feba11218f0349bca6bcc Mon Sep 17 00:00:00 2001 From: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com> Date: Tue, 21 Apr 2026 12:14:53 -0700 Subject: [PATCH 3/3] fix: always run build-docs on PRs; gate deploy-preview via paths-filter Remove the workflow-level paths filter so build-docs always runs as a required CI check on every PR. Add a lightweight 'changes' job using dorny/paths-filter to detect whether docs-relevant files changed, and condition deploy-preview on that output so previews are still only deployed for PRs that touch docs/**, modelopt/**, or pages.yml. Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com> --- .github/workflows/pages.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index f4b86fb56a9..1e2ddc75ab9 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -4,10 +4,6 @@ on: pull_request: types: [opened, synchronize, reopened, closed] branches: [main, release/*, feature/*] - paths: - - "docs/**" - - "modelopt/**" - - ".github/workflows/pages.yml" push: branches: [main] schedule: @@ -42,9 +38,27 @@ jobs: path: docs/build/html retention-days: 1 + changes: + if: github.event_name == 'pull_request' && github.event.action != 'closed' + runs-on: ubuntu-latest + outputs: + docs: ${{ steps.filter.outputs.docs }} + steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + docs: + - 'docs/**' + - 'modelopt/**' + - '.github/workflows/pages.yml' + deploy-preview: - if: always() && github.event_name == 'pull_request' - needs: build-docs + if: | + always() && + github.event_name == 'pull_request' && + (github.event.action == 'closed' || needs.changes.outputs.docs == 'true') + needs: [build-docs, changes] runs-on: ubuntu-latest timeout-minutes: 10 # Per-PR concurrency without cancel-in-progress so 'closed' cleanup always runs