diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 000000000000..315596762236 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,20 @@ +name: commitlint + +on: + pull_request: + +jobs: + lint-commits: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: 18 + + - run: npm install --no-save @commitlint/cli @commitlint/config-conventional + - run: npx commitlint --from origin/next --to HEAD +; diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 12775310c5f7..0cecf928122d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,3 +32,15 @@ If you're looking for a good place to start, look for issues labeled ["good firs - I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - Every change is related to the PR description. - I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist). + +## Commit messages + +This repository follows the Conventional Commits specification. + +Format: +type(scope)!: short, lowercase description + +Examples: +- fix(avm): correct calldata offset handling +- chore(ci): avoid duplicate slack notifications +- feat(bb)!: remove deprecated proving api diff --git a/commitlint.config.cjs b/commitlint.config.cjs new file mode 100644 index 000000000000..7dbe520937d8 --- /dev/null +++ b/commitlint.config.cjs @@ -0,0 +1,13 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'type-enum': [ + 2, + 'always', + ['feat', 'fix', 'chore', 'refactor', 'docs', 'test', 'perf', 'ci'], + ], + 'scope-case': [2, 'always', 'kebab-case'], + 'subject-case': [2, 'always', ['lower-case']], + 'subject-full-stop': [2, 'never', '.'], + }, + }; diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 000000000000..e4262d226725 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,4 @@ +commit-msg: + commands: + commitlint: + run: npx commitlint --edit {1}