Giter Club home page Giter Club logo

pr-lint-action's Introduction

Pull Request Lint

It is a linter of pull requests for GitHub Actions.

Why?

To enforce pull request titles in the same format will be useful like generating standard changelog messages. Besides it can be used to parse titles and link with issue tracking systems such as JIRA.

Example:

name: PR lint

on:
  pull_request:
    types: ['opened', 'edited', 'reopened', 'synchronize']

jobs:
  pr-lint:
    runs-on: ubuntu-latest
    steps:
    - uses: seferov/pr-lint-action@master
      with:
        title-regex: '^\[PROJECT-\d*\](\ )'
        title-regex-flags: 'g' # optional
        error-message: 'Add Jira ID to your title' # optional

In this example, for every pull request the title is expected to match ^\[PROJECT-\d*\]\ regex with a global flag g. For instance, [PROJECT-123] lorem ipsum or [PROJECT-2345] dolor sit amet are valid titles for this example. You can customize the title regex for your needs. The regex flags configuration is optional.

Auto-close

It can be configured to close pull request automatically if the title does not match the pattern provided. To do so, github-token and auto-close-message options must be configured. In the message, %pattern% is replaced with the actual the pattern provided. Here is an example pull request.

Config:

name: PR lint

on:
  pull_request:
    types: ['opened', 'edited', 'reopened', 'synchronize']

jobs:
  pr-lint:
    runs-on: ubuntu-latest
    steps:
    - uses: seferov/pr-lint-action@master
      with:
        title-regex: '^\[PROJECT-\d*\](\ )'
+       github-token: ${{ secrets.GITHUB_TOKEN }}
+       auto-close-message: 'Closing this pull request since the title does not match %pattern% pattern. Please fix the title and re-open the pull request.'

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.