Skip to content
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
80 changes: 80 additions & 0 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Commitlint configuration for conventional commits
# Based on: https://www.conventionalcommits.org/

extends:
- '@commitlint/config-conventional'

rules:
# Type enum - allowed commit types
type-enum:
- 2 # Level: error
- always
- # Allowed types:
- feat # New feature
- fix # Bug fix
- docs # Documentation only changes
- style # Code style changes (formatting, missing semi-colons, etc)
- refactor # Code refactoring (neither fixes a bug nor adds a feature)
- perf # Performance improvements
- test # Adding or updating tests
- build # Changes to build system or dependencies
- ci # CI/CD configuration changes
- chore # Other changes that don't modify src or test files
- revert # Revert a previous commit

# Type case should be lowercase
type-case:
- 2
- always
- lower-case

# Type must not be empty
type-empty:
- 2
- never

# Scope case should be lowercase
scope-case:
- 2
- always
- lower-case

# Subject must not be empty
subject-empty:
- 2
- never

# Subject must not end with a period
subject-full-stop:
- 2
- never
- '.'

# Disable subject-case to allow uppercase abbreviations (PR, API, CLI, etc.)
subject-case:
- 0

# Header (first line) max length
header-max-length:
- 2
- always
- 72

# Body should have a blank line before it
body-leading-blank:
- 1 # Warning level
- always

# Footer should have a blank line before it
footer-leading-blank:
- 1 # Warning level
- always

# Body max line length
body-max-line-length:
- 1 # Warning level
- always
- 100

# Help URL shown in error messages
helpUrl: 'https://www.conventionalcommits.org/'
53 changes: 25 additions & 28 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
name: Commit Lint
name: Lint Commit Messages

on:
pull_request:
types:
- opened
- edited
- synchronize
types: [opened, edited, reopened, synchronize]

permissions:
contents: read
pull-requests: read

jobs:
lint:
lint-pr-title:
name: Lint PR Title
runs-on: ubuntu-latest
steps:
- name: Check PR title format
uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
types: |
feat
fix
docs
style
refactor
perf
test
build
ci
chore
revert
requireScope: false
subjectPattern: ^[a-z].+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
starts with a lowercase letter.
node-version: '20'

- name: Install commitlint
run: |
npm install --save-dev @commitlint/cli@18.4.3 @commitlint/config-conventional@18.4.3

- name: Validate PR title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
echo "Validating PR title: $PR_TITLE"
echo "$PR_TITLE" | npx commitlint --verbose
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- 'wrangler.toml'
- '.github/workflows/deploy.yml'
workflow_dispatch:

jobs:
Expand All @@ -35,7 +37,7 @@ jobs:
- name: Build
run: npm run build

- name: Deploy to Cloudflare Pages
- name: Deploy to Cloudflare Workers
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
Expand Down