mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
665d3458b6
Change detection (`git diff HEAD~1`) only covers the whole change set when the checkout is the PR merge commit. `build-and-test` runs on `pull_request` while `build-and-deploy` ran on `push` for upstream PR branches, so a multi-commit push whose last commit was docs-only made `build-and-deploy` skip the preview build while deploy tests in `build-and-test` waited up to 30 minutes for a preview tarball that never got published. `build-and-deploy` now triggers on the same events as `build-and-test` (`push` to the default branch and `pull_request`), while still accepting release tags and workflow dispatch. The `deploy-target` fork guard is removed since upstream PRs are no longer covered by a push run, and `create-release-branch.js` now rewrites the workflow's branch list alongside the existing `refs/heads/canary` replacement so release branches keep their staging deploys. Preview tarball creation now uses the PR head sha instead of falling back to the merge-commit sha on `pull_request` `opened` events (`github.event.after` only exists on `synchronize`), matching the sha that `upload_preview_tarballs.yml` publishes under and that tests poll for. This fallback was a pre-existing bug that only affected fork PRs; it would have started affecting every upstream PR's first run once previews moved to the `pull_request` event.