Skip to content

infra: add PR preview deployment via canister pool#219

Merged
marc0olo merged 5 commits intomainfrom
infra/pr-preview-canister
May 7, 2026
Merged

infra: add PR preview deployment via canister pool#219
marc0olo merged 5 commits intomainfrom
infra/pr-preview-canister

Conversation

@marc0olo
Copy link
Copy Markdown
Member

@marc0olo marc0olo commented May 7, 2026

Summary

  • Adds 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 with icp deploy frontend -e ic --mode reinstall, and posts the preview URL as a bot comment.
  • Adds pr-cleanup.yml: triggered on PR close. Returns the canister to the pool and deletes the bot comment.
  • Adds .github/workflows/scripts/: pool.py, request-canister.py, release-canister.py, comments.cjs — adapted from dfinity/portal. Changes from portal originals: env var renamed ICP_IDENTITY_PREVIEWPOOL_CONTROLLER_IDENTITY; comments.js renamed to comments.cjs to avoid ESM conflict with "type": "module" in package.json.
  • Updates build.yml: now only runs for fork PRs. Non-fork PRs get their build check through preview-deployment.yml (which fails the job if the build or deploy fails).
  • Bumps icp-cli from 0.2.0 to 0.2.6 in both preview-deployment.yml and deploy-ic.yml.

Differences from portal

portal developer-docs
Secret name DFX_IDENTITY_PREVIEW POOL_CONTROLLER_IDENTITY
Canister name portal frontend
icp-cli install curl installer v0.1.0 npm i -g @icp-sdk/icp-cli@0.2.6
Node version 20 22
comments helper comments.js comments.cjs (ESM fix)

Prerequisites (outside this PR)

  • POOL_CONTROLLER_IDENTITY and POOL_CANISTER_ID secrets must be set in repo settings (confirmed done).
  • The identity behind POOL_CONTROLLER_IDENTITY must be a controller of the pool canisters.

Sync recommendation

hand-written

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.
@marc0olo marc0olo requested a review from a team as a code owner May 7, 2026 13:43
marc0olo added 2 commits May 7, 2026 15:49
…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").
Comment thread .github/workflows/scripts/comments.cjs
@dfinity dfinity deleted a comment from github-actions Bot May 7, 2026
Comment thread .github/workflows/pr-cleanup.yml Outdated
@marc0olo marc0olo merged commit 78e3a06 into main May 7, 2026
7 of 8 checks passed
@marc0olo marc0olo deleted the infra/pr-preview-canister branch May 7, 2026 14:15
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.

3 participants