mergeable icon indicating copy to clipboard operation
mergeable copied to clipboard

PR is getting merged before pipeline starts

Open JerryMacedoCastro opened this issue 3 years ago • 5 comments

If all criteria pass, the pr is merged even before the pipeline has started. Is there any way to check if the pipeline already ran?

mergeable:
  - when: pull_request.*, pull_request_review.*
    validate:
      - do: title
        # Do not merge WIP.
        must_exclude:
          regex: 'wip|work in progress'
      - do: label
        # Do not merge WIP.
        must_exclude:
          regex: 'wip|work in progress'
        # Do not merge WIP.
      - do: label
        must_exclude:
          regex: 'DO NOT MERGE'
        # At least two senior approve
      - do: approvals
        min:
          count: 1
        limit:
          users:
            [
              'user1', 
              'user2'
            ]
        # It must have a milestone
      - do: milestone
        begins_with:
          match: 'PR Merge List Order for'
        # Check QA approve or if no QA review is needed
      - do: or
        validate:
          - do: label
            must_include:
              regex: 'NoEmbeddedQA'
          - do: approvals
            min:
              count: 1
            limit:
              users: ['user1', 'user2]
    pass:
      - do: merge
        merge_method: 'squash'
      - do: checks
        status: 'success'```

JerryMacedoCastro avatar Jul 18 '22 11:07 JerryMacedoCastro

@JerryMacedoCastro IIRC if you have the other checks as required as part of a protected branch, it won't merge until those are green. Other than that, I am not sure how to prevent this from happening.

shine2lay avatar Jul 18 '22 16:07 shine2lay

IIRC

Is there a way to add a check for other pipelines? I mean, one of the checks is Danger JS https://danger.systems/js/. Can we add a check to wait until danger is completed?

JerryMacedoCastro avatar Jul 18 '22 17:07 JerryMacedoCastro

currently, no.

shine2lay avatar Jul 18 '22 23:07 shine2lay

@JerryMacedoCastro I think so other ways like putting a label if a danger check is not done (danger-check-not-done). The mergeable check should check for that label if still exists then it must not pass the merge action.

tenshiAMD avatar Aug 26 '22 22:08 tenshiAMD

@JerryMacedoCastro or using comments

tenshiAMD avatar Aug 27 '22 01:08 tenshiAMD