Skip to content

has_labels predicate should support looser matching #952

@reegnz

Description

@reegnz

Currently the has_labels predicate requires all labels to be present on the pull request.

There's some use-cases when you want to make sure it's an either/or, or one or more of the labels should be present on the pull_request, but not all of them.

Example rule I want to define:

  • A pull request should have either fizzbuzz:true or fizzbuzz:false label declared
  • The pull request must only have one of those labels declared.

Ideally it should be an approval rule like this:

policy:
  approval:
  - fizzbuzz-label-presence
approval_rules:
- name: fizzbuzz-label-presence
  requires:
    has_labels:
    - or:
       - "fizzbuzz:true"
       - "fizzbuzz:false"

Either make the has_labels predicate support boolean logic (like with the approvals), or provide a has_any_label predicate that allows a looser predicate matching on labels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions