Skip to content

Deploy a preview again when a pull request opens without one - #37

Closed
plmercereau wants to merge 1 commit into
mainfrom
fix/preview-after-reopen
Closed

plmercereau wants to merge 1 commit into
mainfrom
fix/preview-after-reopen

Conversation

@plmercereau

Copy link
Copy Markdown
Collaborator

Why

Pull request #35 had no preview. Its branch had been opened as #34, closed 49 seconds later, and opened again as #35 on the same commit. Closing #34 ran our cleanup workflow, which deleted the branch's preview (Deleting dpl_Cqi8UMN3MZpTX2G9hhkt7XGuQiye in its log). Vercel deploys on push, not when a pull request opens, so #35 got nothing, while its Vercel status still pointed at the deleted deployment.

What changes

  • The workflow also runs on opened and reopened. A second job looks for a deployment of the head commit and, when there is none, creates one through Vercel's API from the branch.
  • The closed job is unchanged.
  • The file is renamed preview-deployments.yml, since it no longer only deletes. ADR 0004 gets a sentence.

Checks

  • Prettier clean.
  • End-to-end test on this pull request, recorded below: close it, which deletes its preview, then reopen it, which must bring a preview back.

https://claude.ai/code/session_01BLKZu4E8T123xzXASL2erH

Vercel deploys on push, not when a pull request opens. A branch whose
pull request was closed lost its previews to our cleanup, and opening a
new pull request on the same commit did not bring one back (#34, #35).

Claude-Session: https://claude.ai/code/session_01BLKZu4E8T123xzXASL2erH
@vercel

vercel Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
wee-app Ready Ready Preview Sep 18, 2026 9:24am UTC

Request Review

@plmercereau

Copy link
Copy Markdown
Collaborator Author

End-to-end test done on this pull request. Closing it ran the delete job (Deleting dpl_2bDHKJR8AKm1Q5sM9QAjYtM7MMXk), after which the branch URL answered 404. Reopening it ran the new job, which found no preview of the head commit and created dpl_AWysiuoZdfHxBzPhJzfncNx4ia75; a minute later the branch URL answered again. Runs 35329212778 and 35329268744.

@plmercereau

Copy link
Copy Markdown
Collaborator Author

Closed on the maintainer's decision: the workflow stays as it is on main. A pull request that loses its preview after a close and reopen gets one back with a new push, for example an empty commit.

@plmercereau
plmercereau deleted the fix/preview-after-reopen branch September 18, 2026 12:13

This branch was successfully deployed

1 active deployment
Preview — f94820e6 Deployed Sep 18, 2026 by vercel[bot]
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