Skip to content

ci: tear down PR previews immediately on close#80

Merged
odesenfans merged 1 commit into
mainfrom
feature/pr-preview-cleanup-on-close
Jun 15, 2026
Merged

ci: tear down PR previews immediately on close#80
odesenfans merged 1 commit into
mainfrom
feature/pr-preview-cleanup-on-close

Conversation

@odesenfans

Copy link
Copy Markdown
Contributor

Adds the closed event to the PR-preview workflow's pull_request trigger so a preview is torn down the moment its PR is closed or merged, instead of waiting for the next pull request event.

This relies on web3-hosting-action v2.1.0 (web3-hosting-action#4), which added a cleanup-only mode: on a closed event the action removes the preview and skips the deploy/comment steps, so it never recreates the preview it just removed. The @v2 tag now points at that release.

Change

on:
  pull_request:
    types: [opened, synchronize, reopened, closed]

The full types list is intentional - listing only [closed] would drop the opened/synchronize/reopened defaults and stop previews deploying on push.

Notes

  • The closed path is exercised when this PR (or a later one) is closed/merged; the deploy path is verified by the normal preview run on this PR.
  • Fork PRs remain skipped (the existing head.repo.full_name == github.repository guard); they never get a preview to clean up.

Add the closed event to the preview workflow's trigger types. With
web3-hosting-action v2.1.0 the action runs cleanup-only on a closed event
(removes the preview without redeploying), so previews are torn down the
moment a PR is closed or merged instead of on later PR activity.
@github-actions

Copy link
Copy Markdown

Deployed on:

Preview for this pull request, updated on every commit and removed once the PR is closed.

@foxpatch-aleph foxpatch-aleph left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small, correct one-line config change that adds closed to the pull_request event types so PR previews are torn down immediately instead of waiting for the next PR event. The comment block is rewritten accurately to explain the new strategy, and the dependency on web3-hosting-action@v2 (now pointing at v2.1.0) is called out in the description. No logic errors, no security issues.

.github/workflows/pr-preview.yml (line 25): Comment mentions the action runs in "cleanup-only mode" on closed events. This depends on web3-hosting-action@v2 actually resolving to v2.1.0+. Worth verifying the @v2 tag has been updated to point at that release before merging (the PR description says it has, but it's a soft dependency).

@odesenfans odesenfans merged commit befa645 into main Jun 15, 2026
1 check passed
@odesenfans odesenfans deleted the feature/pr-preview-cleanup-on-close branch June 15, 2026 22:31
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.

2 participants