Skip to content

Commit Message Lint 1.0 (Old)

sumits-systango edited this page Jul 9, 2019 · 1 revision

Installation and Setup

Installation

Use the Github's app section or the app URL to install the app to your repository.

App URL

https://github.com/apps/commit-message-lint

Setup

You would need to add a configuration file named .validationconfig to the root of your repository. The contents of that file will be:

PR_TITLE_REGEX=<PR Title Regex>
COMMIT_MESSAGE_REGEX=<Commit Message Regex>

Usage

Go to the checks section on your PR to see the result of the check run performed by the app. It will show you the result as well as the commit messages which failed.

If a developer does not adhere to the format, the check section of PR will show failure for this app. Then the reviewer can take the decision on whether to merge the PR or not.

If the app is not configured and the .validationconfig file is not provided, the app will mark the check as success but the message will show that the file is not configured.

The idea is to enforce developers to follow a specific format for their commit messages and PR title, so that there is consistency. Also, this allows organisations to integrate other tools which function by extracting information out of the commit messages.

Example

Let's take below regex as examples for PR title and commit messages:

PR_TITLE_REGEX=/((?:[a-z][a-z]+))(\d{3})(:)([a-z0-9])/i
COMMIT_MESSAGE_REGEX=/(#)(#)((?:[a-z][a-z]+))(\d{3})(:)([a-z0-9])/i

For above regex, the corresponding valid messages would be:

PR message - JIR123:login feature

Commit message - ##JIR302:login feature