Skip to content

Could criteria not be a list of tiggers? #1169

Description

@Rooba

In the docs --

Due to a issue12 in PyYAML, criteria keys must be unique. This sometimes becomes relevant when you want to apply different operators (like contains and ncontains) to the same trigger data:

criteria:
  trigger.payload.commit.tags:  # duplicate key - ignored!
    type: ncontains
    pattern: StackStorm
  trigger.payload.commit.tags:  # duplicate key - evaluated
    type: contains
    pattern: pull request
  trigger.payload.commit.message:  # unique key - evaluated
    type: ncontains
    pattern: ST2

I would think the following would be a fairly simple way to get around that issue

criteria:
  - trigger.payload.commit.tags:
      type: ncontains
      pattern: StackStorm
  - trigger.payload.commit.tags:
      type: contains
      pattern: pull request
  - trigger.payload.commit.message:
      type: ncontains
      pattern: ST2

or even something like

criteria:
  - trigger: payload.commit.tags
    type: ncontains
    pattern: StackStorm
  - trigger: payload.commit.tags 
    type: contains
    pattern: pull request
  - trigger: payload.commit.message
    type: ncontains
    pattern: ST2

Footnotes

  1. https://github.com/yaml/pyyaml/issues/41

  2. https://github.com/yaml/pyyaml/issues/165

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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