mergeable icon indicating copy to clipboard operation
mergeable copied to clipboard

TypeError: Cannot read property 'filter' of undefined

Open saloni-jain opened this issue 4 years ago • 2 comments

The configuration in my mergeable.yml looks like:

version: 2
mergeable:
  - when: pull_request.*
    name: JIRA linked check
    filter:
      - do: repository
        topics:
          must_include:
            regex: 'topic1'
            message: 'Mergeable only enabled for topic1'
    validate:
      - do: title
        must_exclude:
          regex: ^\[WIP\]
          message: 'Cannot merge Work In Progress'
      - do: or
        validate:
          - do: title
            or:
              - must_include:
                  regex: 'jira-[\d]{1,6}'
                  message: 'Jira Ticket must be present in the pull request title'
              - must_include:
                  regex: 'myjira-\d+'
                  message: 'JIRA Ticket for other board must be present in the pull request title'
          - do: description
            or:
              - must_include:
                  regex: 'jira-[\d]{1,6}'
                  message: 'Jira Ticket must be present in the pull request description'
              - must_include:
                  regex: 'myjira-\d+'
                  message: 'blah....'
              - must_include:
                  regex: '(close[sd]?|fix(es|ed)?|close[sd]?|resolve[sd]?) ([a-z0-9_-]+\/[a-z0-9_-]+)?#\d+'
                  message: 'The pull request must address a BBGitHub issue'
          - do: label
            must_include:
              regex: 'no-ticket'
              message: 'If no Jira ticketis required, please include the label "no-ticket" in your pull request'
    pass:
      - do: request_review
        teams: ['myteam']
  
  - when: pull_request.*
    name: PR mergeable check
    filter:
      - do: repository
        topics:
          must_include:
            regex: 'topic1'
            message: 'Mergeable only enabled for topic1'
    validate:
      - do: approvals
        min:
          count: 1 # Number of minimum reviewers.
          message: 'At least one approval is required'
      - do: label
        must_exclude:
          regex: 'donotmerge|dontmerge|DONOTMERGE'
          message: 'Cannot merge with Do Not Merge label'

I am not sure why I get an error on filter field. I only want to run the validation checks if the repository has the specified topic.

Is the config structure wrong or am I using filter incorrectly?

saloni-jain avatar Oct 11 '21 19:10 saloni-jain

@saloni-jain this is most likely because of wrong config structure, can you send me the screen shot of the full error received?

shine2lay avatar Oct 13 '21 17:10 shine2lay

Here it is.

image

saloni-jain avatar Oct 13 '21 20:10 saloni-jain