Skip to content

feat: prevent deployment when the target branch is not the default branch #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

GrantBirki
Copy link
Member

@GrantBirki GrantBirki commented Dec 12, 2024

Prevent unsafe "branch of branch" deploys

This pull request implements a new check that will reject deployments of pull requests that target a branch other than the default branch (aka stable branch).

Example 📸

Screenshot 2024-12-12 at 10 56 26 AM

resolves: #340

@GrantBirki GrantBirki added bug Something isn't working enhancement New feature or request labels Dec 12, 2024
@GrantBirki GrantBirki self-assigned this Dec 12, 2024
@GrantBirki GrantBirki marked this pull request as ready for review December 12, 2024 18:58
@Copilot Copilot AI review requested due to automatic review settings December 12, 2024 18:58
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 4 changed files in this pull request and generated no suggestions.

Comments skipped due to low confidence (1)

src/functions/prechecks.js:97

  • The error message should be more specific about why deploying to a non-default branch is dangerous. Consider providing additional context or examples.
message = `### ⚠️ Cannot proceed with deployment

This pull request is attempting to merge into the `${baseRef}` branch which is not the default branch of this repository (`${data.inputs.stable_branch}`). This deployment has been rejected since it could be dangerous to proceed.`

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

@GrantBirki GrantBirki merged commit a4e13bd into main Dec 12, 2024
4 checks passed
@GrantBirki GrantBirki deleted the default-branch-target-checks branch December 12, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent deployment when the target branch is not the default branch
1 participant