cognovi-ai / the-cdj

The Cognitive Distortion Journal (CDJ) is a smart journaling tool that helps remedy distorted thinking. It can feel impossible to follow the CBT technique of labeling and reframing distorted thinking when you've been thinking this way your whole life. The CDJ can help with that 🧠✨ -- v2 is in development!
https://thecdj.app
4 stars 0 forks source link

Integrate a git hook for enforcing and validating conventional commit style #197

Open davidzlu opened 5 days ago

davidzlu commented 5 days ago

The project uses conventional commits, but style is currently enforced only through code reviews. Integrating more automation into this would standardize the commit message style, and allow contributors and reviewers to focus on code over process.

One library that could implement this is: https://github.com/qoomon/git-conventional-commits

hiyaryan commented 5 days ago

This is a great idea! Here's some additional resources I found that we can look into.

Conventional Commit Spec - Spec mentioned throughout actions listed below.

  1. Customizable Conventional Commits: This action ensures all commit messages follow the Conventional Commits spec. You can tweak the allowed commit types to fit a project’s needs. 

  2. Conventional Commits PR: This action validates pull request titles against the Conventional Commits preset. This is useful for squash merges.

  3. Conventional PR Title: Checks that PR titles match the Conventional Commits spec. Helpful when using semantic-release with the Conventional Commits preset. 

  4. Conventional Commits GitHub Action: Verifies all commit messages adhere to the Conventional Commits specification.

To set up any of these actions, add a workflow file in .github/workflows directory. Example using the Customizable Conventional Commits action:

name: Conventional Commits
on:
  pull_request:
    branches:
      - main
jobs:
  build:
    name: Conventional Commits
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: gentleseal/action-conventional-commits@master
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

This setup will check that all commit messages in your pull requests follow the Conventional Commits standard. You can customize the valid-commit-types parameter to specify which commit types are allowed.