Coder Social home page Coder Social logo

bijujoseph / pr-lint-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vijaykramesh/pr-lint-action

0.0 1.0 0.0 382 KB

A GitHub Action that verifies your pull request contains a reference to a Jira ticket.

License: MIT License

Dockerfile 3.11% JavaScript 96.89%

pr-lint-action's Introduction

pr-lint-action

A GitHub Action that verifies your pull request contains a reference to a ticket. You can use this to (optionally) check:

  • The PR title contains [PROJ-1234]
  • The branch name contains PROJ-1234 or PROJ_1234
  • Each commit contains [PROJ-1234]

Usage

Add .github/workflows/main.yml with the following:

name: PR Lint
on: [pull_request]
jobs:
  pr_lint:
    runs-on: ubuntu-latest
    steps:
    - uses: vijaykramesh/[email protected]
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Configuration

Configure by creating a .github/pr-lint.yml file:

For example:

projects: ['PROJ', 'ABC']
check_title: true
check_branch: true
check_commits: true
ignore_case: true

Testing

Run jest test to test:

PASS  ./index.test.js
  pr-lint-action
    ✓ fails if check_title is true and title does not match (180ms)
    ✓ passes if check_title is false and title does not match (66ms)
    ✓ passes if check_title is true and title matches (67ms)
    ✓ fails if check_branch is true and branch does not match (66ms)
    ✓ passes if check_branch is false and branch does not match (61ms)
    ✓ passes if check_branch is true and branch matches (64ms)
    ✓ passes if check_commits is true and all commits match (66ms)
    ✓ fails if check_commits is true and some commits do not match (59ms)
    ✓ passes if check_commits is false and all commits match (61ms)
    ✓ passes if check_commits is false and some commits do not match (62ms)
    ✓ fails if check_branch and check_title is true and title does not match (59ms)
    ✓ fails if check_branch and check_title is true and title does not match (63ms)
    ✓ passes if check_branch and check_title is true and both match (61ms)
    ✓ passes if ignore_case and lower case title/branch (58ms)
    ✓ passes if ignore_case and lower case commits (65ms)
    ✓ fails if not ignore_case and lower case title/branch (66ms)

Contributing

If you have other things worth automatically checking for in your PRs, please submit a pull request.

pr-lint-action's People

Contributors

vijaykramesh avatar dependabot[bot] avatar whitfieldc avatar jedster1111 avatar

Watchers

James Cloos avatar

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.