Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could criteria not be a list of tiggers? #1169

Open
Rooba opened this issue Mar 20, 2024 · 1 comment
Open

Could criteria not be a list of tiggers? #1169

Rooba opened this issue Mar 20, 2024 · 1 comment

Comments

@Rooba
Copy link

Rooba commented Mar 20, 2024

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

@fdrab
Copy link

fdrab commented Mar 21, 2024

can't you write a regex for the tags criteria?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants