-
Notifications
You must be signed in to change notification settings - Fork 18
Migrating from v5 to v6
PullPreview v6 no longer supports the v5 always_on behavior.
In v6, PullPreview is PR-centric:
- labeled pull requests create or update previews
- pushes to the PR branch redeploy the preview
- removing the label destroys the preview
- closing or merging the PR destroys the preview
- optional
scheduleruns are only used for cleanup of dangling deployments
If you keep pullpreview/action@v6 in a workflow that runs directly on push for your default branch, it will not keep that branch deployed. Without a PR number, v6 falls back to branch cleanup behavior instead of deploying. See issue #131.
When upgrading from v5:
- remove the
always_oninput - do not use
pushto invokepullpreview/action@v6for deployments - keep
pull_requestevents for deploy/update/destroy - keep
scheduleonly if you want periodic cleanup of dangling resources
Example v6 workflow shape:
name: PullPreview
on:
schedule:
- cron: "30 */4 * * *"
pull_request:
types: [labeled, unlabeled, synchronize, closed, reopened, opened]
jobs:
deploy:
if: github.event_name == 'schedule' || github.event.label.name == 'pullpreview' || contains(github.event.pull_request.labels.*.name, 'pullpreview')
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@v6
- uses: pullpreview/action@v6If you used always_on to keep main, master, or staging continuously deployed, the recommended workaround in v6 is to use a long-lived PR that mirrors that branch:
- Create a dedicated branch such as
preview-main. - Open a PR from
preview-maininto your default branch and keep it open. - Add your PullPreview trigger label to that PR.
- Sync
preview-mainfrom your default branch on every push.
That mirror push updates the PR head branch, which triggers a pull_request synchronize event and redeploys the preview in v6.
Example mirror workflow:
name: Sync preview branch
on:
push:
branches: [main]
permissions:
contents: write
jobs:
sync-preview-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git checkout -B preview-main origin/main
git push --force origin preview-mainNotes:
- keep this mirroring workflow separate from the PullPreview workflow
- trigger the mirroring workflow only from the source branch you want to mirror, to avoid loops
- if you need multiple persistent environments, create one long-lived PR branch per environment
If your current setup depends on branch-based always-on deploys and you cannot move to the PR-based workaround yet, staying on v5 temporarily is reasonable. Just treat that as a short-term stopgap, because the v6 docs and new features assume the PR-only model.