Why a pull request is merged despite failing the merge checks ?

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Cloud のみ - この記事は、 クラウド プラットフォームのアトラシアン製品にのみ適用されます。

要約

When branches of a pull request are merged locally, and the merge commit is pushed to the destination branch(remote), the pull request associated is automatically marked as "MERGED" bypassing merge checks.

This is only applicable to workspaces on the Premium plan

診断

Pull request with "enforced merge checks" are automatically marked as "MERGED" bypassing merge checks

原因

The branches are merged locally and the merge commit is pushed to the destination branch(remote). The reason is that the pull request detects the changes are present from source to destination and proceeds to identify it as merged leading it to be marked as MERGED even though the merge checks are not passed.

Steps to Reproduce:

  • Set up branch permissions for the master branch with "Prevent a merge with unresolved merge checks" enabled and a few other merge conditions. 
  • For example, the screenshot below has 3 merge checks,
    • Minimum number of approvals
    • Minimum number of approvals from default reviewers
    • No changes are requested and enabled


  • Create a pull request between feature and master, source - feature, and destination is master
  • Now, check out the branches locally and merge them

    $ git checkout master
    $ git merge feature
  • And then push the merge commit to the master branch(remote).

    $ git push origin master
  • The pull request associated is marked as "MERGED" as soon as the merge commit is pushed bypassing merge checks.

提案

To avoid merging Pull requests bypassing merge checks, especially for the main branches(or production branches) in a repository, you can restrict direct push to the branch by creating a branch restriction rule. 

手順:

Start by navigating to the repository you want to limit permissions for, select Repository settings, then select Branch restrictions.

Add permissions to the master branch:

  1. Select Add a branch restriction.

  2. Enter the following into each field, then select Save:

    1. 名前またはパターン: master

    2. On the Branch permissions tab under Write access, select Only specific people or groups have write access: John Doe


Sample branch restriction rule:


If you are encountering issues following this documentation - please raise a support ticket or a community support ticket for further assistance.

説明 Why a pull request is merged despite failing the merge checks ?
製品Bitbucket Cloud
最終更新日: 2024 年 1 月 29 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.