feat(actions): add preview-only input to deploy-client-stack action#241
Open
feat(actions): add preview-only input to deploy-client-stack action#241
Conversation
Adds an explicit `preview-only` input to the deploy-client-stack action so consumers can run `pulumi preview` (dry-run) from CI without applying any changes. Maps to a new PREVIEW_ONLY env var that the github-actions binary's existing isPreviewMode() check now recognises. Use case: validating in-flight SC API changes against a real consumer stack before merging the SC change. Until now, the only ways to dry-run a deploy were via the legacy SC env vars (SC_PREVIEW, SC_DRY_RUN, etc.) or by running on a pull_request trigger. Neither is convenient when the deploy is normally invoked from a workflow_dispatch. Wiring: - New action input `preview-only: 'false'` (default keeps current behavior) - Sets `PREVIEW_ONLY` env var on the docker container - isPreviewMode() in pkg/githubactions/actions/executor.go now also returns true when PREVIEW_ONLY=true - New `preview-mode` action output exposes the resolved mode (already emitted by the binary, just needed declaring in action.yml) Tests: - TestExecutor_IsPreviewMode covers all preview env triggers individually, asserts non-"true" values do not flip the mode, and verifies the pull_request auto-preview path When isPreviewMode() returns true, executeDeploy() routes to provisioner.Preview() instead of provisioner.Deploy() — that branch was already present in operation_executor.go, no changes needed there. Signed-off-by: Dmitrii Creed <creeed22@gmail.com>
Semgrep Scan ResultsRepository:
Scanned at 2026-05-10 07:24 UTC |
Security Scan ResultsRepository:
Scanned at 2026-05-10 07:25 UTC |
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
Adds an explicit
preview-onlyinput to thedeploy-client-stackGitHub Action so consumers can runpulumi preview(dry-run) from CI without applying any changes.Until now, the only ways to dry-run a deploy via this action were the legacy SC env vars (
SC_PREVIEW,SC_DRY_RUN,SC_DEPLOY_PREVIEW,DRY_RUN) or running on apull_requesttrigger. Neither is convenient when the deploy is normally invoked fromworkflow_dispatch.Wiring
preview-only: 'false'(default keeps current behavior)PREVIEW_ONLYenv var on the docker containerisPreviewMode()now also returns true whenPREVIEW_ONLY=truepreview-modeaction output exposes the resolved mode (the binary already emits it, just needed declaring in action.yml)When
isPreviewMode()returns true,executeDeploy()routes toprovisioner.Preview()instead ofprovisioner.Deploy()— that branch was already present, no changes needed there.Use case
Validating in-flight SC API changes against a real consumer stack before merging the SC change. For example, a workflow that normally runs:
can now opt into preview-only with one extra line:
Tests
TestExecutor_IsPreviewMode(new) — covers all preview env triggers individually, asserts non-"true"values do not flip the mode, and verifies thepull_requestauto-preview pathTest plan
go test ./pkg/githubactions/...passesgo build ./...cleanpreview-only: 'true', confirm the run completes with no Pulumi changes applied andpreview-mode=truein outputs