Skip to content

Commit

Permalink
ci: add commitlint (workflow and hooks)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLicense committed Feb 9, 2024
1 parent fade00f commit aabd3ca
Show file tree
Hide file tree
Showing 7 changed files with 2,186 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/website"
directory: "/"
versioning-strategy: "increase-if-necessary"
schedule:
interval: "weekly"
groups:
dependencies:
root-dependencies:
patterns:
- "*"

Expand All @@ -18,3 +18,13 @@ updates:
github-action-dependencies:
patterns:
- "*"

- package-ecosystem: "npm"
directory: "/website"
versioning-strategy: "increase-if-necessary"
schedule:
interval: "weekly"
groups:
dependencies:
patterns:
- "*"
37 changes: 37 additions & 0 deletions .github/workflows/check-pr-title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Check PR title

on:
pull_request:
types:
- opened
- edited
- synchronize
workflow_call:
inputs:
title:
description: 'PR title'
type: string
required: true

permissions:
contents: read

concurrency:
group: check-pr-title-${{ github.event.pull_request.id || github.run_id }}
cancel-in-progress: true

jobs:
check-pr-title:
name: PR title
runs-on: ubuntu-latest
env:
TITLE: ${{ inputs.title || github.event.pull_request.title }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "npm"
- run: npm ci
- name: Validate PR title
run: echo "$TITLE" | npx --no commitlint
1 change: 1 addition & 0 deletions .husky/commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
11 changes: 11 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type {UserConfig} from '@commitlint/types';
import * as fs from "fs";

const Configuration: UserConfig = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': [2, 'always', fs.readdirSync('app').filter((file) => fs.statSync(`app/${file}`).isDirectory())],
}
};

module.exports = Configuration;
Loading

0 comments on commit aabd3ca

Please sign in to comment.