Optional ephemeral environments using GitHub PR labels
A walkthrough of how to make ephemeral PR environments optional using GitHub PR labels, without breaking branch protection rules. The solution splits a single GitHub Actions workflow job into three: a mandatory build job, an optional deploy-ephemeral job (skipped when a 'skip-ephemeral' label is present on the PR), and a pr-ready gate job that always runs and acts as the required status check. The gate job uses if: always() and checks whether build succeeded and deploy-ephemeral either succeeded or was deliberately skipped, exiting with code 1 if not. This approach preserves branch protection integrity while giving developers per-PR control over ephemeral environment deployments, and because the workflow is shared across teams via a platform engineering model, the change benefits all consuming teams immediately.