My Workflow
Contribution guidelines of popular projects often include a recommended title styling like this one from facebook/docusaurus:
feat: allow overriding of webpack config
^--^ ^------------^
| |
| +-> Summary in present tense.
|
+-------> Type: chore, docs, feat, fix, refactor, style, or test.
PR Title Checker helps maintainers organise their projects better by tagging titles that do not conform to such guidelines. No, it doesn't check if the summary is in present tense ๐
. At least not yet!
Pull Request Titles can be checked for certain prefixes (or even regexps, or both!) and tagged automatically if they fail to comply. This usually prompts the author themselves to fix it so that when a maintainer wakes up from their hard-fought night's sleep, they don't have to be faced with weirdly named pull requests even after they had it all perfectly laid out in the Contribution guidelines. Oh and btw, this little Github action can also show you if the author has reaaaaally read the Contribution Guidelines ;)
Submission Category:
Maintainer Must-Haves (or Wacky Wildcards for Maintainers perhaps? ๐ค)
Yaml File or Link to Code
thehanimo / pr-title-checker
An action to automatically check if pull request titles conform to Contribution Guidelines
Pull Request Title Checker
This action checks if PR titles conform to the Contribution Guidelines โ๏ธ
Consistent title names help maintainers organise their projects better ๐
Shows if the author has reaaaaally read the Contribution Guidelines :P
Usage
Create a config file .github/pr-title-checker-config.json
like this one below:
{
"LABEL": {
"name": "title needs formatting",
"color": "EEEEEE"
},
"CHECKS": {
"prefixes": ["fix: ", "feat: "],
"regexp": "docs\\(v[0-9]\\): ",
"regexpFlags": "i",
"ignoreLabels" : ["dont-check-PRs-with-this-label", "meta"]
},
"MESSAGES": {
"success": "All OK",
"failure": "Failing CI test",
"notice": ""
}
}
You can pass in one of prefixes
or regexp
or even both based on your use case. regexpFlags
andโฆ
Additional Resources / Info
This was my first shot at building a Github action (and a DEV post!). Since it's just released, not many projects use it yet! (You can help change that here ๐)
Would love to hear your thoughts below! ๐ญ
Top comments (2)
Hey, great action Hani. Curious how you validate if the contribution ha read the guidelines?
Thanks a lot Brian! Well, if they did read the guidelines, the title would match the required template and the action wouldn't tag it as "title needs formatting". So if you see a PR being tagged by this action despite having clear title formatting requirements, it is possible that the author missed that part ๐ It is kinda quirky in a way..