infra: add PR preview deployment via canister pool#219
Merged
Conversation
Adds preview-deployment.yml and pr-cleanup.yml to automatically deploy each non-fork PR to a temporary canister from the preview pool and post the URL as a PR comment. Adapts the dfinity/portal pattern for this repo: secret renamed (IDENTITY_PREVIEW), canister name changed to 'frontend'. build.yml now only runs for fork PRs; non-fork PRs get their build check through the preview deployment job.
…SM error Renames IDENTITY_PREVIEW -> POOL_CONTROLLER_IDENTITY across all workflow files and scripts. Renames comments.js -> comments.cjs so Node does not treat it as an ES module (package.json has "type": "module").
adamspofford-dfinity
previously approved these changes
May 7, 2026
lwshang
reviewed
May 7, 2026
lwshang
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
preview-deployment.yml: triggered on PR open/sync/reopen for non-fork PRs. Requests a canister from the pool, builds and deploys the site to it withicp deploy frontend -e ic --mode reinstall, and posts the preview URL as a bot comment.pr-cleanup.yml: triggered on PR close. Returns the canister to the pool and deletes the bot comment..github/workflows/scripts/:pool.py,request-canister.py,release-canister.py,comments.cjs— adapted fromdfinity/portal. Changes from portal originals: env var renamedICP_IDENTITY_PREVIEW→POOL_CONTROLLER_IDENTITY;comments.jsrenamed tocomments.cjsto avoid ESM conflict with"type": "module"inpackage.json.build.yml: now only runs for fork PRs. Non-fork PRs get their build check throughpreview-deployment.yml(which fails the job if the build or deploy fails).icp-clifrom0.2.0to0.2.6in bothpreview-deployment.ymlanddeploy-ic.yml.Differences from portal
DFX_IDENTITY_PREVIEWPOOL_CONTROLLER_IDENTITYportalfrontendv0.1.0npm i -g @icp-sdk/icp-cli@0.2.6comments.jscomments.cjs(ESM fix)Prerequisites (outside this PR)
POOL_CONTROLLER_IDENTITYandPOOL_CANISTER_IDsecrets must be set in repo settings (confirmed done).POOL_CONTROLLER_IDENTITYmust be a controller of the pool canisters.Sync recommendation
hand-written