Skip to content

Replace Azure Static Web App action with az + swa CLI - #3692

Open
Jake Bailey (jakebailey) wants to merge 6 commits into
microsoft:v2from
jakebailey:preview-swa-cli
Open

Jake Bailey (jakebailey) wants to merge 6 commits into
microsoft:v2from
jakebailey:preview-swa-cli

Conversation

@jakebailey

@jakebailey Jake Bailey (jakebailey) commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

This allows us to get rid of a copied token in favor of OIDC, and has the side benefit of eliminating the problem that led to #3691.

Preview deployment should not depend on the stale Azure action release
or a deployment token stored in GitHub.

An isolated preview identity keeps deployment access separate from
package-signing permissions. Artifact-provided CLI configuration must not
be able to redirect uploads to privileged runner files.
These deployments are PR previews, not staging sites. Keep recognizing
the old wording so redeployments do not leave duplicate bot comments.
Keep Azure resource selection with the isolated environment's identity
settings instead of hardcoding it in both workflows. Missing settings
must fail before deployment or cleanup.
Azure's delete command polls a subscription-scoped operation endpoint
that the preview identity cannot read. Confirm deletion through the
resource-scoped environment list without broadening its permissions.
The SWA CLI searches configuration directories recursively, so a nested
fixture can override the intended root configuration. Isolate that root
file before passing its directory to the deployment client.

Copilot AI 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.

🟡 Changes recommended

The unconditional configuration-file copy fails because the Gatsby artifact lacks staticwebapp.config.json, aborting normal preview deployments before swa runs.

1 open issue
What changed in this PR

Replaces the Azure Static Web Apps action with Azure and SWA CLI commands, using OIDC authentication instead of a stored deployment token and avoiding the action’s preview-input warnings.

Changes:

  • Deploys PR previews through the SWA CLI and retrieves their URLs from Azure.
  • Deletes closed PR previews through Azure, with polling to confirm removal.
  • Updates preview comment wording while retaining cleanup of legacy comments.
File Description
.github/​workflows/​deploy-preview.yml Adds OIDC login, CLI deployment, URL lookup, and updated preview comments.
.github/​workflows/​close-preview.yml Adds OIDC login and Azure-based preview deletion with completion polling.

Review effort: Balanced

Comment thread .github/workflows/deploy-preview.yml Resolved
Normal Gatsby builds do not include staticwebapp.config.json. Treat its
absence as an empty configuration while keeping nested artifact files
out of runtime configuration discovery.

Copilot AI 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.

🔵 Needs a closer look

A maintainer should validate deployment and deletion with the configured Azure identity because the required environment variables, OIDC federation, and RBAC grants cannot be verified from the diff.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
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