Giter Site home page Giter Site logo

systangotechnologies / commit-message-lint Goto Github PK

View Code? Open in Web Editor NEW
98.0 6.0 5.0 592 KB

Github app to validate commit message on a pull request

License: MIT License

JavaScript 94.03% HTML 5.97%
github-app commit-message conventions pull-request-validate pull-request lint

commit-message-lint's Introduction

Commit Message Lint

Github app to validate commit message and pull request title on a pull request

Description

This app runs a format check on commit messages and pull request title on the creation of a pull request.

For example, let's say you specify that a commit message should have a format DDD:message. Here D stand for numeric digit. The app checks if the commit message follows this format. If all the commit messages follow this format, the check returns successful, otherwise failure. The reviewer can then decide if they want to go ahead with the code merge.

App URL

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

Installation

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

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>
OUTPUT_TITLE_FAIL: Message validation failed!!!
OUTPUT_TITLE_SUCCESS: Message validation passed!!!
VALID_COMMIT_MESSAGE: Commit messages are valid
INVALID_COMMIT_MESSAGE: Commit messages are invalid
SINGLE_OTHER_INVALID_MESSAGE: other message is invalid
MULTIPLE_OTHER_INVALID_MESSAGE: other messages are invalid
VALID_PULL_REQUEST_MESSAGE: Pull request title is valid
INVALID_PULL_REQUEST_MESSAGE: Pull request title is invalid

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.

Local setup

Step 1. Clone the application. Step 2. Run npm install Step 3. Create .env file in the root directory and set the following environment variables in .env file :

    APP_ID - Github app id (get from app settings page)
    WEBHOOK_PROXY_URL - URL of the hosted application, use ngrok for local
    WEBHOOK_SECRET - webhook secret for security, same as the one set in github app settings
    PRIVATE_KEY - Get from github app settings page
    LOG_LEVEL - Log level
    REGEX_CONFIG_FILE_NAME - config file which contains repo config, keep it as config.yml
    GITHUB_BASE_PATH - Github API path, keep it as https://api.github.com

Note : Take values of APP_ID, WEBHOOK_PROXY_URL, WEBHOOK_SECRET, PRIVATE_KEY from https://github.com/settings/apps/commit-message-lint

Step 4. Run npm start to start the application

Resources

Purchase Flow

Identifying and authorizing users for GitHub Apps

Integrating with the GitHub Marketplace API

Contributors

Anshul Soni

Sumit Singhal

Vikas Patidar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.