Skip to content

Commit Message Lint 2.1.0

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

Installation and Setup

Release 2.0 - Permissions Update

If you were using version 1.0 of the app, you might be prompted to accept updated permissions required by the app. The new permission is required to support private repos without accessing the code.

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

Configuration

You would need to add a configuration folder named .github at the root of your repository. The folder should contain a file named config.yml. This file will serve as the configuration and 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 config.yml 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.

Re-run

This application also support re-run. For example, if your check fails due to invalid PR title, just edit the existing PR title and click on the re-run button present in the checks section.

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