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

ci: add commitlint to enforce the Conventional Commits specification #8

Merged
merged 3 commits into from
Feb 12, 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
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
Loading