Skip to content

Latest commit

 

History

History
44 lines (40 loc) · 1.48 KB

README.md

File metadata and controls

44 lines (40 loc) · 1.48 KB

Commitlint hook for pre-commit

Configuration

  • Create your commitlint config file in the repo's root, as explained in Commitlint docs.
  • Add the following to your .pre-commit-config.yaml:
    - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
      rev: <latest tag>
      hooks:
          - id: commitlint
            stages: [commit-msg]
    
  • If you are using one of Commitlint's shared configurations, add it to the additional_dependencies parameter of the hooks, i.e:
    - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
      rev: <latest tag>
      hooks:
          - id: commitlint
            stages: [commit-msg]
            additional_dependencies: ['@commitlint/config-angular']
    
  • Install the commit-msg hook in your project repo:
    pre-commit install --hook-type commit-msg

Usage in Travis CI

  • Add the following to your .pre-commit-config.yaml:
    - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
      rev: <latest tag>
      hooks:
          - id: commitlint-travis
            stages: [manual]
    
  • Add the following to your .travis.yml:
    script:
      - pip install pre-commit
      - pre-commit run --hook-stage manual commitlint-travis