Skip to content

Commit

Permalink
ci: enforce commit message standards with commitlint (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsanima authored Feb 24, 2024
1 parent 49103f2 commit 7491860
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Defined rules on commit messages; see the docs: https://commitlint.js.org/#/reference-rules

const TypesArray = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test"];
const SubjectsArray = ["upper-case", "pascal-case", "sentence-case", "start-case"];

const Configuration = {
rules: {
"type-enum": [2, "always", TypesArray],
"type-case": [2, "always", "lower-case"],
"type-empty": [2, "never"],
"scope-case": [2, "always", "kebab-case"],
"subject-case": [2, "never", SubjectsArray],
"subject-empty": [2, "never"],
"subject-full-stop": [2, "never", "."],
"header-max-length": [2, "always", 80],
"body-case": [2, "always", "sentence-case"],
"body-leading-blank": [2, "always"],
"body-max-line-length": [2, "always", 100],
"footer-leading-blank": [2, "always"],
"footer-max-line-length": [2, "always", 100],
},
};

module.exports = Configuration;
23 changes: 23 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint Commit Messages

on: [pull_request]

permissions:
contents: read
pull-requests: read

jobs:
commitlint:
name: Commitlint
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run commitlint
uses: wagoid/commitlint-github-action@v5
with:
configFile: .github/commitlint.config.js

0 comments on commit 7491860

Please sign in to comment.