Skip to content
two-incPublic

About

Custom git hooks for Two repositories

Resources

Stars

0 stars

Watchers

4 watching

Forks

Repository files navigation

git-hooks

This repo contains custom git hooks we use at Two. To add a hook to a repo you have to add it to the repo's .pre-commit-config.yaml file

Add Hook To Repo

First make sure you have installed pre-commit in your repo with brew install pre-commit and installed the relevant hooks with pre-commit install --hook-type <type>. See stages in .pre-commit-hooks.yaml for relevant hook types. For more information on pre-commit usage, refer to docs.

Example Config

To only check for a reference to a Linear issue in your commit message, add this:

# .pre-commit-config.yaml
- repo: https://github.com/two-inc/git-hooks.git
  rev: 26.10.06
    hooks:
      - id: linear-ref

To check for both a reference to a Linear issue as well as a conventional commit type (<Linear ref>/<conventional commit type>[!]: <description>), add this:

# .pre-commit-config.yaml
- repo: https://github.com/two-inc/git-hooks.git
  rev: 26.10.06
    hooks:
      - id: commit-type-with-linear-ref

Alternatively, you can use ssh

# .pre-commit-config.yaml
- repo: https://github.com/two-inc/git-hooks
  rev: 26.10.06
    hooks:
      - id: commit-type-with-linear-ref

Developmment

1. Create virtual environment

source venv/bin/activate
python3 -m venv venv

2. Install requirements

pip3 install -e '.[dev]'

3. Release

Run the Release workflow (Actions -> Release -> Run workflow). It runs bumpver update on main, which commits the bump, tags it with today's CalVer version and pushes, then creates a GitHub release with generated notes. Set version to override the date-based version. Then bump rev: in consuming repos.

About

Custom git hooks for Two repositories

Resources

Stars

0 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages