chore: add force deployment option to bypass changeset guard#7727
chore: add force deployment option to bypass changeset guard#7727liuliu-dev merged 1 commit intomainfrom
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR updates the production deployment GitHub Actions workflow to allow manually forcing a deployment via workflow_dispatch, intended to bypass the existing “changeset guard” that prevents deploying when unreleased changesets are present.
Changes:
- Added a
workflow_dispatchboolean inputforce_deployto support manual forced deployments. - Updated the
guardjob’sshould_deployoutput to allow bypassing the existing deploy gating logic whenforce_deployis enabled.
| # If it's 0, we deploy. | ||
| should_deploy: ${{ steps.changeset-count.outputs.change_count == 0 && steps.has-pages.outputs.pages == 1 }} | ||
| # If it's 0, we deploy. Can be bypassed with force_deploy input. | ||
| should_deploy: ${{ inputs.force_deploy == true || (steps.changeset-count.outputs.change_count == 0 && steps.has-pages.outputs.pages == 1) }} |
There was a problem hiding this comment.
should_deploy reads inputs.force_deploy and compares it to the boolean true. In this repo, workflow_dispatch booleans are typically read from github.event.inputs.<name> and treated as strings (e.g. release-schedule.yml uses DRY === 'true'), and inputs isn’t reliably populated for non-workflow_dispatch triggers like push. As written, force_deploy may never evaluate true (if the value is 'true') and/or could break evaluation on push. Suggest switching to github.event.inputs.force_deploy == 'true' with a safe fallback for non-dispatch runs, or guarding on github.event_name == 'workflow_dispatch' before reading the input.
| should_deploy: ${{ inputs.force_deploy == true || (steps.changeset-count.outputs.change_count == 0 && steps.has-pages.outputs.pages == 1) }} | |
| should_deploy: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.force_deploy == 'true') || (steps.changeset-count.outputs.change_count == 0 && steps.has-pages.outputs.pages == 1) }} |
| # If it's 0, we deploy. Can be bypassed with force_deploy input. | ||
| should_deploy: ${{ inputs.force_deploy == true || (steps.changeset-count.outputs.change_count == 0 && steps.has-pages.outputs.pages == 1) }} |
There was a problem hiding this comment.
The new force_deploy bypass is applied to the entire guard condition, including the has-pages check. That means a forced run would proceed even when steps.has-pages.outputs.pages != 1, which likely leads to a failing/no-op deploy and doesn’t match the intent of “bypass changeset guard” only. Consider keeping the has-pages requirement and only bypassing the changeset-count portion of the condition.
This pull request updates the production deployment workflow to add an option for manually forcing a deployment, even if there are unreleased changes. This provides more flexibility for urgent or exceptional deployment scenarios.