From 7754fdbb443e6799fb5067dbf81327373f19edcf Mon Sep 17 00:00:00 2001 From: Lars Vilhuber Date: Sun, 9 Aug 2026 20:00:26 -0400 Subject: [PATCH 1/2] Add PR preview workflow that builds the site as a downloadable artifact Runs the same Jekyll build as the main deploy workflow, but on pull requests it uploads the rendered _site as a workflow artifact instead of publishing to gh-pages, so a build can be inspected before merge. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/pr-preview.yml | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/pr-preview.yml diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml new file mode 100644 index 00000000..e38027e9 --- /dev/null +++ b/.github/workflows/pr-preview.yml @@ -0,0 +1,40 @@ +# Build website for pull requests +# Builds the Jekyll site and uploads it as a downloadable workflow artifact, +# without publishing it anywhere. Lets reviewers download and inspect the +# rendered site before it goes live via the main "Build website" workflow. + +name: Build PR preview + +on: + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3.4 + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Build Jekyll website + run: | + set -xo pipefail + rm -rf _site/* + gem install bundler -v 2.6.3 + bundle install + bundle exec jekyll build + - name: Generate agent instruction file + run: python3 .github/scripts/generate_agent_md.py + - name: Upload site as artifact + uses: actions/upload-artifact@v4 + with: + name: site-preview-${{ github.event.pull_request.number }} + path: _site + retention-days: 14 From e5522d6cd0ef3f211457fb0d70509201443c3730 Mon Sep 17 00:00:00 2001 From: Lars Vilhuber Date: Sun, 9 Aug 2026 20:02:00 -0400 Subject: [PATCH 2/2] Split build and publish into separate jobs in a single workflow Replaces the standalone PR-preview workflow with a build/publish split inside the existing "Build website" workflow, avoiding duplicated build steps. The build job now runs on push, pull_request, and manual dispatch, uploading _site as a workflow artifact every time. The publish job (deploy to gh-pages) only runs on push to main, or on a manual dispatch with the "publish" input checked. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/main.yml | 33 +++++++++++++++++++++++++- .github/workflows/pr-preview.yml | 40 -------------------------------- 2 files changed, 32 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/pr-preview.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 02ddd42c..1d34727f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,12 +1,26 @@ -# Publish to gh-pages +# Build and (conditionally) publish to gh-pages # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby +# +# The site is always built - on pushes to main, on pull requests, and on +# manual runs - and the rendered _site is uploaded as a downloadable +# workflow artifact. Publishing to gh-pages only happens on pushes to main, +# or on a manual run with the "publish" option checked. name: Build website on: push: branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + inputs: + publish: + description: 'Publish to gh-pages' + type: boolean + required: false + default: false jobs: build: @@ -34,6 +48,23 @@ jobs: bundle exec jekyll build - name: Generate agent instruction file run: python3 .github/scripts/generate_agent_md.py + - name: Upload site artifact + uses: actions/upload-artifact@v4 + with: + name: site + path: _site + retention-days: 14 + + publish: + needs: build + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish) + runs-on: ubuntu-latest + steps: + - name: Download site artifact + uses: actions/download-artifact@v4 + with: + name: site + path: _site - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml deleted file mode 100644 index e38027e9..00000000 --- a/.github/workflows/pr-preview.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Build website for pull requests -# Builds the Jekyll site and uploads it as a downloadable workflow artifact, -# without publishing it anywhere. Lets reviewers download and inspect the -# rendered site before it goes live via the main "Build website" workflow. - -name: Build PR preview - -on: - pull_request: - branches: [ main ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.3.4 - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: Build Jekyll website - run: | - set -xo pipefail - rm -rf _site/* - gem install bundler -v 2.6.3 - bundle install - bundle exec jekyll build - - name: Generate agent instruction file - run: python3 .github/scripts/generate_agent_md.py - - name: Upload site as artifact - uses: actions/upload-artifact@v4 - with: - name: site-preview-${{ github.event.pull_request.number }} - path: _site - retention-days: 14