mergeable icon indicating copy to clipboard operation
mergeable copied to clipboard

Fail filters on unsupported events

Open abid-mujtaba opened this issue 8 months ago • 0 comments

Scenario

version: 2
mergeable:
  - when: pull_request.*, pull_request_review.*, status.*, check_suite.*
    name: "Automatically merge pull requests once it passes all checks"
    validate: []
    filter:
      - do: author
        must_include:
          regex: "some-bot"
    pass:
      - do: merge
        merge_method: "rebase"

This config is trying to auto-merge PRs that are authored by a particular bot. However, it causes the PR to be merged even when it is not authored by some-bot.

Diagnosis

The author filter does not support status.* and check_suite.* events. For these events the filter passes by default and the merge action is carried out.

Recommended Solution

Add a (backwards-compatible) config to filters that should fail them if a filter is applied to an event it does not support. This is particular useful when one is trying to use must_include filter.

abid-mujtaba avatar Apr 09 '25 15:04 abid-mujtaba