From 7ab953c3c113dc824eb3719ed13d4eae5e73d3c1 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Fri, 6 Nov 2026 11:04:33 +0000 Subject: [PATCH 1/2] ci: Validate JupyterBook build on PRs without deploying --- .github/workflows/renderbook.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/renderbook.yml b/.github/workflows/renderbook.yml index 17de3eb..a1ed65c 100644 --- a/.github/workflows/renderbook.yml +++ b/.github/workflows/renderbook.yml @@ -6,6 +6,9 @@ on: - main - master - setup_jupyter_book + pull_request: + branches: + - main workflow_dispatch: # allow manual triggers # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages @@ -40,6 +43,7 @@ jobs: jupyter-book build . - name: Setup Pages + if: github.event_name == 'push' uses: actions/configure-pages@v5 - name: Upload artifact @@ -48,5 +52,6 @@ jobs: path: '_build/html' - name: Deploy to GitHub Pages + if: github.event_name == 'push' id: deployment uses: actions/deploy-pages@v4 From 0c78d16e8d5a7c947fd1b5ee4a5de1b1f3110f20 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Mon, 9 Nov 2026 11:52:47 +0000 Subject: [PATCH 2/2] ci: split JupyterBook build and Pages deploy jobs Build the book on every push and pull request so PRs validate the build without touching GitHub Pages. Move the protected github-pages environment, Pages permissions, and deploy-pages step into a separate deploy job that only runs outside pull requests. Manual workflow_dispatch runs still deploy as before. --- .github/workflows/renderbook.yml | 43 ++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/renderbook.yml b/.github/workflows/renderbook.yml index a1ed65c..4ca11f0 100644 --- a/.github/workflows/renderbook.yml +++ b/.github/workflows/renderbook.yml @@ -11,28 +11,22 @@ on: - main workflow_dispatch: # allow manual triggers -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read - pages: write - id-token: write -# Allow one concurrent deployment +# Cancel superseded PR builds, but never cancel an in-progress Pages deployment concurrency: - group: "pages" + group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.ref) || 'pages' }} cancel-in-progress: true jobs: - render: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - + build: + # Compile the book on every push and pull request. PRs stop here. runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - + - uses: actions/checkout@v4 + - name: Install dependencies run: | python3 -m pip install --upgrade pip @@ -42,16 +36,27 @@ jobs: run: | jupyter-book build . - - name: Setup Pages - if: github.event_name == 'push' - uses: actions/configure-pages@v5 - - - name: Upload artifact + - name: Upload Pages artifact uses: actions/upload-pages-artifact@v4 with: path: '_build/html' - + + deploy: + # Publish only for pushes and manual runs; pull requests never deploy. + if: github.event_name != 'pull_request' + needs: build + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + + permissions: + pages: write + id-token: write + + steps: - name: Deploy to GitHub Pages - if: github.event_name == 'push' id: deployment uses: actions/deploy-pages@v4