thehanimo / pr-title-checker

An action to automatically check if pull request titles conform to Contribution Guidelines
MIT License
106 stars 36 forks source link

Does this Action support something like: "feat(whatever): Issue-Name (#ISSUE-IDENTIFIER)"? #35

Closed JustJakeCalifornia closed 1 year ago

JustJakeCalifornia commented 1 year ago

Does this action support this linting? For Example: "feat(authentication): Creating Login UI + Logic(#GGG-2)" or "test: Implement Unit tests for Authentication(#GG-5)"

thehanimo commented 1 year ago

If you can figure out a regex for it, it should

JustJakeCalifornia commented 1 year ago

@thehanimo Alright. So that is my regex:

(fix|feat|build|chore|ci|docs|style|refactor|test)(\(([^)]+)\))?:\s.*\s\(#\w{1,3}-\d+\)

How should my json look like because I already set the prefixes at another point of the config or is that optional?

thehanimo commented 1 year ago

prefixes is optional so you can either delete it or pass in an empty array.

Your regexp field under CHECKS would look like this:

"regexp": "(fix|feat|build|chore|ci|docs|style|refactor|test)(\\(([^)]+)\\))?:\\s.*\\(#\\w{1,3}-\\d+\\)"

Notice how double backslashes are required to put literal \ characters in the string. Also, I noticed a bug in your regexp where you have an extra \s before (#ISSUE-IDENTIFIER) but I'm not sure if you meant that. If you did, then your examples given above wouldn't work.

JustJakeCalifornia commented 1 year ago

Alright, I'll take a look and let you know :)

JustJakeCalifornia commented 1 year ago

One more question: What is the property regexpFlags and is it optional? Is ignoreLabels also optional?

JustJakeCalifornia commented 1 year ago

I just tried it and it works perfectly. Thanks for the great tool.

thehanimo commented 1 year ago

Yes, regexpFlags and ignoreLabels are both optional. You can find more about the flags here.