Skip to content

Prevent deployment when the target branch is not the default branch #340

Closed
@GrantBirki

Description

@GrantBirki

Currently, you are able to open a pull request that is targeting a branch other than the default (i.e. main) and you can deploy that branch while bypassing branch protection rules.

For example, you might have a branch protection rule on main that says a PR must be approved before it can be deployed. If you simply open a PR that targets a branch other than main, you would be able to deploy those changes without an approval.

Example:

gitGraph
    commit
    commit
    branch develop
    checkout develop
    commit
    commit
    branch bug-fix
    commit id: "fix error" type: HIGHLIGHT
Loading

In this example, you could not deploy any of the commits from the develop branch as they are trying to merge into the main branch which has a branch protection rule requiring passing CI, approvals, etc. However, if you open a PR from the bug-fix branch, you could .deploy the fix error commit without issues since it is not targeting a branch with branch protection (or rulesets).

This is a bug and it should be resolved.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions