Closed Neeraj-swarnkar closed 1 year ago
Yes, you should be able to do this via a regex. I'm not aware of one offhand, but it would involve using the |
character to OR together the different prefixes.
@Neeraj-swarnkar you would need to use a regexp with a |
between formats you'd like to support (like @jcw- mentioned). In your JSON file under the "CHECKS"
field, you already have support for a regexp (not sure if it was intentional) where you are allowing PR title of the format docs(vx)
where x is a number between 0-9. If you want to support multiple such regexps, use something like so:
"regexp": "(feat\\(.*\\))|(fix\\(.*\\)):",
which supports fix(parser):
and feat(feature-name):
like you mentioned. But it also accepts fix():
and feat():
. You can tailor this regexp to your need.
@thehanimo , @jcw- Thanks to both of you for suggetions,
"regexp": "(?<type>build|chore|ci|docs|feat|fix|perf|refactor|revert|test)(?<scope>(?:/([^()\r\n]*/)|/()?(?<breaking>!)?:)(?<subject>:.*)?",
I will be trying to use this, I hope this looks good. https://regex101.com/r/vmBkEe/1
Thanks for your help..
That's a complex regex and needs a really good look into it. I'm not sure why you need \r
or \n
in the scope capture group. But that's a different discussion to be had. I'm not an expert when it comes to regex so I'd suggest testing it out thoroughly just in case :)
Hope this was helpful! Closing this issue.
Sure, Thanks for the help..
Hi Team,
I am using your Action/Workflow, Thanks for the great effort, I need your help, I want to use https://www.conventionalcommits.org/en/v1.0.0/#examples conventional-changelog/commitlint for PR title check
Can we use some regex for this, or if this action support this already how to use it ?
Please guide. I am sharing my json and yml code below. Thanks.
JSON file -
YML file -
prefixes
in JSON is totally working fine for commits title, but there could be some other examples like fix(parser):, feat(feature-name):, breaking change, !, etc. Can we use regexp for commitlint for PR title or something.I don't want to switch to another action, so I am asking for solution.
@thehanimo, @feychenie, @jcw-