Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint commit messages to enforce consistency #1059

Merged
merged 12 commits into from
Mar 14, 2024
23 changes: 23 additions & 0 deletions .commitlintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
rules:
header-case:
- 2
- always
- - sentence-case
header-max-length:
- 2
- always
- 50
header-full-stop:
- 2
- never
- "."
body-case:
- 2
- always
- - sentence-case
body-leading-blank:
- 2
- always
type-empty:
- 2
- always
27 changes: 27 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint commit messages

on:
pull_request:

permissions:
contents: read
pull-requests: read

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- name: Checkout "main" branch
Ndpnt marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.base.ref }}

- name: Checkout the current pull request branch
run: git checkout ${{ github.event.pull_request.head.ref }}

- name: Install dependencies
run: npm ci

- name: Lint commit messages
run: npm run commit-messages:lint
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased [no-release]

_Modifications made in this changeset do not add, remove or alter any behavior, dependency, API or functionality of the software. They only change non-functional parts of the repository, such as the README file or CI workflows._

## 0.37.1 - 2024-02-20

_Full changeset and discussions: [#1056](https://github.com/OpenTermsArchive/engine/pull/1056)._
Expand Down
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ We strive to follow this [recommendation](https://chris.beams.io/posts/git-commi
- [Capitalize the subject line](https://chris.beams.io/posts/git-commit/#capitalize).
- [Do not end the subject line with a period](https://chris.beams.io/posts/git-commit/#end).
- [Use the imperative mood in the subject line](https://chris.beams.io/posts/git-commit/#imperative).
- [Wrap the body at 72 characters](https://chris.beams.io/posts/git-commit/#wrap-72).
Ndpnt marked this conversation as resolved.
Show resolved Hide resolved
- [Use the body to explain what and why vs. how](https://chris.beams.io/posts/git-commit/#why-not-how).

We add this additional rule:
Except this one:

- ~~[Wrap the body at 72 characters](https://chris.beams.io/posts/git-commit/#wrap-72)~~: As URLs might be used for references in commit messages, the body text is not wrapped to 72 characters to ensure links are clickable in Git user interfaces.

We add these additional rules:

- Do not rely on GitHub issue reference numbers in commit messages, as we have no guarantee the host system and its autolinking will be stable in time. Make sure the context is self-explanatory. If an external reference is given, use its full URL.

Expand Down
Loading
Loading