Skip to content

Fix PR previews for fork PRs - #317

Merged
tipsy merged 1 commit into
masterfrom
fix-pr-previews
Oct 18, 2026
Merged

tipsy merged 1 commit into
masterfrom
fix-pr-previews

Conversation

@tipsy

@tipsy tipsy commented Oct 18, 2026

Copy link
Copy Markdown
Member

Summary

  • PR previews have failed for every fork PR since GitHub changed actions/checkout to refuse checking out fork code in pull_request_target workflows (see Add Javalin monitoring tutorial with StatLite #316, Update virtual thread configuration on main page #315).
  • Instead of opting back in (allow-unsafe-pr-checkout: true, which would let a PR's Gemfile/scripts read SURGE_TOKEN), the preview is split:
    • pr-preview-build.yml: builds on pull_request with no secrets and uploads _site as an artifact.
    • pr-preview-deploy.yml: runs on workflow_run, never executes PR code, verifies the PR number against the built commit, deploys to surge, and comments.
    • pr-previews.yml: now teardown-only (it never checks out PR code, so pull_request_target stays safe there).

Test plan

  • This PR's own build workflow runs and uploads the site artifact.
  • After merge (workflow_run only uses the default branch's copy): push to or close/reopen Add Javalin monitoring tutorial with StatLite #316 and confirm the preview deploys and the comment appears.
  • If the surge step fails with an auth error, rotate SURGE_TOKEN. It hasn't been exercised since April.

🤖 Generated with Claude Code

actions/checkout now refuses to check out fork code in a pull_request_target
workflow, which broke previews for every fork PR. Opting back in would let a
PR's Gemfile or scripts read SURGE_TOKEN, so split the workflow instead: build
on pull_request with no secrets, then deploy the built files from a
workflow_run that never executes PR code and verifies the PR number against
the built commit. Teardown stays on pull_request_target since it never checks
out PR code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

🗑 Deploy Preview for javalin.io deleted.

Name Link
🔨 Latest commit 36a8651
🔍 Latest deploy log https://github.com/javalin/website/actions/runs/39171587849

@tipsy
tipsy merged commit 7bd3d3c into master Oct 18, 2026
4 of 5 checks passed
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