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

build(root): lint commit messages #148

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {RuleConfigSeverity} from "@commitlint/types";

/**
* @type {import('@commitlint/types').UserConfig}
*/
const Configuration = {
extends: ['@commitlint/config-conventional'],
rules: {
"scope-empty": [RuleConfigSeverity.Error, "never"],
"scope-enum": [
RuleConfigSeverity.Error,
"always",
[
"components",
"examples",
"github-actions",
"root", // used by dependabot to update the root package.json
]
],
"body-max-line-length": [RuleConfigSeverity.Error, "always", 200],
}
};

export default Configuration;
17 changes: 16 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ updates:
directory: /
schedule:
interval: weekly
commit-message:
prefix: "chore(github-actions)"
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
groups:
minorAndPatch:
update-types:
- "minor"
- "patch"
commit-message:
prefix: "chore(root)"
- package-ecosystem: npm
directory: components/
schedule:
Expand All @@ -12,4 +25,6 @@ updates:
minorAndPatch:
update-types:
- "minor"
- "patch"
- "patch"
commit-message:
prefix: "chore(components)"
28 changes: 28 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Commitlint

on:
pull_request:

jobs:
commitlint:
name: Lint commit messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: lts/*

- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}

- name: Install npm packages
run: npm ci

- name: Validate PR commits with commitlint
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --verbose
Loading