diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 54d7437f9..c3579d2a6 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -4,6 +4,7 @@ on: pull_request: types: - opened + - edited - reopened - synchronize - ready_for_review @@ -29,5 +30,7 @@ jobs: - name: Install npm packages run: npm ci - - name: Validate PR commits with commitlint - run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --verbose + - name: Lint PR title + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: echo "$PR_TITLE" | npx commitlint --verbose \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c3bbffc9a..bda464925 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,9 @@ Contributions are very welcome! Just fork the repository, develop in a branch an ## Commit Messages -We follow [conventional commits](https://www.conventionalcommits.org) when writing commit messages. +Commits on the `main` branch should follow [conventional commits](https://www.conventionalcommits.org). +Since we squash-merge pull requests, the PR title should also follow conventional commits +(because it will become the commit message of the squashed commit). The messages themselves should help future developers understand **why** changes were made. ## Code Style diff --git a/package.json b/package.json index 4b7274c65..007e273f1 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,5 @@ "@commitlint/cli": "^19.4.0", "@commitlint/config-conventional": "^19.2.2", "@commitlint/types": "^19.0.3" - }, - "scripts": { - "commitlint:last-commit": "commitlint --from=HEAD~1 --verbose", - "commitlint:merge-base": "commitlint --from=$(git merge-base HEAD main) --verbose" } }