thehanimo / pr-title-checker

An action to automatically check if pull request titles conform to Contribution Guidelines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

JustJakeCalifornia opened this issue · comments

commented

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)"

commented

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

commented

@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?

commented

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.

commented

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

commented

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

commented

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

commented

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