From b23816836ef9f58171c0474e1532006b6b474b8d Mon Sep 17 00:00:00 2001 From: Justin Stayton Date: Wed, 14 Oct 2026 06:04:46 -0400 Subject: [PATCH] Build pull requests without deploying Catches mistakes in `links.json` before they're merged, now that Suri validates it. Pull requests get their own concurrency group so they can't cancel a queued deploy. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/deploy.yml | 12 +++++++++--- README.md | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 430e240..c9fd4d4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,20 +4,24 @@ on: push: branches: - main + pull_request: workflow_dispatch: permissions: contents: read +# Deploys run one at a time and are never canceled. Pull requests only build, +# so each gets its own group, where a new push cancels the previous build. concurrency: - group: deploy - cancel-in-progress: false + group: ${{ github.event_name == 'pull_request' && format('build-{0}', github.event.pull_request.number) || 'deploy' }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 + - name: Check out repository + uses: actions/checkout@v7 with: persist-credentials: false - name: Setup Node.js @@ -30,11 +34,13 @@ jobs: - name: Build with Suri run: npm run build - name: Upload GitHub Pages artifact + if: github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v5 with: path: build/ include-hidden-files: true deploy: + if: github.event_name != 'pull_request' needs: build permissions: pages: write diff --git a/README.md b/README.md index cb13aa0..fad599a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,8 @@ Suri, including additional deployment options. ### Auto-Deploy Any commits to the `main` branch of your new repository will trigger a new build -and deploy. You can change this by editing +and deploy. Pull requests are built without deploying, so a mistake in +`links.json` is caught before it's merged. You can change this by editing [`.github/workflows/deploy.yml`](.github/workflows/deploy.yml), which is the GitHub Actions workflow for building the site and deploying to GitHub Pages.