Skip to content

Build the landing page on pull requests, publish only from main - #8

Merged
tannevaled merged 1 commit into
mainfrom
pages-pr-build
Aug 30, 2026
Merged

Build the landing page on pull requests, publish only from main#8
tannevaled merged 1 commit into
mainfrom
pages-pr-build

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

[2026-08-30 17:48:26 CEST]

The blind spot

.github/workflows/deploy-pages.yml triggered on push to main and
workflow_dispatch only. Nothing ran on a pull request.

Measured, not assumed. For the two open Renovate pull requests here, #6
(actions/configure-pages v5 to v6) and #7 (actions/deploy-pages v4 to v5),
GET /repos/go-pdfkit/go-pdfkit.github.io/commits/<head sha>/check-runs
returns total_count: 0 for both.

So a change to the very workflow that publishes this site was mergeable with
nothing verifying it, and the first evidence of a mistake would have been a
broken published site. "No checks" is not the same thing as green.

The fix

  • pull_request is added to the triggers, so the build job proves the site
    still builds before a change lands.
  • deploy is gated on github.event_name != 'pull_request'. A pull request
    stops after the build; it never publishes.
  • pages: write and id-token: write move down to the deploy job, the only
    job that needs them. The workflow now grants contents: read and
    pages: read, which is what configure-pages needs in the build job to read
    the Pages settings and compute the base URL. A pull request build therefore
    cannot publish even if a step in it misbehaves.
  • The concurrency group is scoped by ref. Deploys still serialise with one
    another under the main group; each pull request gets a group of its own, so
    it neither waits behind a deploy nor holds one up, and a new push to the same
    pull request supersedes the build still running for it.

Action versions are deliberately untouched. #6 and #7 exist to bump them, and
once this lands they become the proof that the check actually appears.

Fleet context

Every public repository in all 320 organisations was swept: 1820 public repos,
1453 workflow files read, 573 of them publish to GitHub Pages. 565 already
carry a pull_request trigger with a gated deploy job. This repository was one
of only 8 that did not.

The Pages workflow triggered on `push` to main and `workflow_dispatch` only,
so nothing ran on a pull request. Measured, not assumed: the two open Renovate
pull requests here (#6 bumping actions/configure-pages, #7 bumping
actions/deploy-pages) both report `total_count: 0` from
`/repos/go-pdfkit/go-pdfkit.github.io/commits/<sha>/check-runs`. A change to
the very workflow that publishes the site was mergeable with nothing verifying
it, and the first evidence of a mistake would have been a broken published
site.

Add a `pull_request` trigger so the build job proves the site still builds, and
gate the deploy job on the event so a pull request never publishes.

Permissions and concurrency follow from that:

  - the workflow now grants `contents: read` and `pages: read` only. `pages:
    write` and `id-token: write` move down to the deploy job, which is the only
    job that needs them; a pull request build therefore cannot publish even if
    a step in it misbehaves. `configure-pages` runs in the build job and reads
    the Pages settings to compute the base URL, which `pages: read` covers.

  - the concurrency group is scoped by ref. Deploys still serialise with one
    another under the main group, while each pull request gets a group of its
    own so it neither waits behind a deploy nor holds one up, and a new push to
    the same pull request supersedes the build still running for it.

The action versions are deliberately left alone: pull requests #6 and #7 exist
to bump them, and they are now the proof that the check actually appears.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant