mergeable
mergeable copied to clipboard
Issue validation does not run
Hello. I've been trying to set up mergeable to run on issues and pull requests. PR validations works fine, but no issue validation occurs. Mostly interested in ensuring a project and a milestone are added to an issue, and would expect a label and a comment to be added if the validation fails.
Hopefully Git didn't get the yaml indentation wrong below.
version: 2
mergeable:
- when: issues.*
validate:
- do: description
no_empty:
enabled: true
message: A description must be provided
- do: label
no_empty:
enabled: true
message: At least one label must be provided
- do: milestone
no_empty:
enabled: true
message: A milestone must be provided
- do: project
must_include:
regex: 'Engineering|Product'
message: A project must be provided
fail:
- do: labels
labels: ['needs-info']
mode: 'add'
- do: comment
payload:
body: >
One or more of following problems were found with this issue:
- Description is missing
- At least one label musts be provided
- One milestone must be provided
- One project must be provided
@DragosDumitrache I looked into this and the culprit is the implementation of the project.js
validator as it only looks at PRs and not issues, hence returning this error:
TypeError: Cannot read property 'repo' of undefined
at extractIssueIdsFromCards (/app/lib/validators/project.js:72:26)
at Project.validate (/app/lib/validators/project.js:55:26)
at async Promise.all (index 3)
at async processWorkflow (/app/lib/flex/lib/processWorkflow.js:42:22)
at async executeMergeable (/app/lib/flex/flex.js:35:3)
at async /app/lib/mergeable.js:87:7
https://github.com/mergeability/mergeable/blob/bca0d6e237d0f484a3ca3347d6db4565ef25c9d7/lib/validators/project.js#L70-L84
An issue does not have the .head
attribute so it can't retrieve the repo object.
@paul-pop @DragosDumitrache This is certainly a bug with the project validator. We will work on a fix for this.