pr-compliance-action icon indicating copy to clipboard operation
pr-compliance-action copied to clipboard

Allow multiple regexes for issue detection

Open shimonelbaz opened this issue 2 years ago • 5 comments

Is your feature request related to a problem? Please describe. since Github allows multiple ways to link an issue to a PR, (direct reference , full reference , url) it could be nice to have multiple regexes as input in order to cover all options or if referencing to some external options. it is also useful if you want to detect multiple dependencies / requirements.

Describe the solution you'd like option to input multiple regexes (bonus: parameter to define if the result should consider an OR option between the results or an AND option - meaning , should any of the regexes match or all of them)

Describe alternatives you've considered running the action multiple times in the same flow with different regex everytime and use some env variable to manage the results.

Additional context N/A

shimonelbaz avatar Dec 29 '22 08:12 shimonelbaz

@shimonelbaz thanks for filing this issue! I could see the appeal of having multiple regular expressions available to you, but I'm not sure I understand the use case of matching all regular expressions rather than any. In other words, why would a contributor need to specify linked issues in multiple formats? Let me know if you can elaborate on that use case.

mtfoley avatar Dec 29 '22 20:12 mtfoley

Hi, I think that the usecase i have in mind is for instance when having a github issue and a jira ticket for using one for dev and one for support.

shimonelbaz avatar Dec 29 '22 20:12 shimonelbaz

OK, I follow you. If you'd prefer to contribute this feature in a PR, I can assign this issue to you. Otherwise, I'll keep you posted on this issue!

mtfoley avatar Dec 29 '22 20:12 mtfoley

If i will learn some typescript soon i will take it on myself, otherwise we can leave it to someone else for now.. :)

shimonelbaz avatar Dec 29 '22 21:12 shimonelbaz

Hi @shimonelbaz I've got the feature drafted in a branch if you want to try it out. https://github.com/mtfoley/pr-compliance-action/tree/multiple-body-regex So with this branch the body-regex input is a multiline input, and the body-regex-match-all can be set to true to require all patterns to be matched (by default any match will pass the check).

body-regex: |
  (fixes|resolves) #\d+
  JIRA ABC-\d+
body-regex-match-all: true

mtfoley avatar Dec 31 '22 03:12 mtfoley