Skip to content

Commit

Permalink
ci: add commitlint to enforce the Conventional Commits specification (#8
Browse files Browse the repository at this point in the history
)

* ci: add commitlint (workflow and hooks)

* fix: add empty app directories

* ci: rename `check-pr-title`
  • Loading branch information
JoshuaLicense authored Feb 12, 2024
1 parent fade00f commit be6a3c6
Show file tree
Hide file tree
Showing 10 changed files with 2,192 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/conventional-commits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Conventional Commits

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: Check 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
2 changes: 2 additions & 0 deletions app/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions app/internal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions app/selfserve/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
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 be6a3c6

Please sign in to comment.