Skip to content

feat: Add commit lint check workflow #10

feat: Add commit lint check workflow

feat: Add commit lint check workflow #10

Workflow file for this run

name: Commit Message Linter
on:
pull_request:
types: [opened, synchronize]
jobs:
lint-commits:
runs-on: ubuntu-latest
steps:
# Checkout the repository with full history
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history
# Set up Node.js v20.17.0
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '20.17.0'
# Install dependencies in the ./app directory
- name: Install dependencies
run: npm ci
working-directory: ./app
# Check installed packages (debugging step)
- name: Check installed packages
run: npm list --depth=0
working-directory: ./app
# Fetch base branch and merge (ensure all commit history is available)
- name: Fetch base branch and merge
run: |
git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}
git merge --no-commit --no-ff ${{ github.event.pull_request.base.ref }}
# Run commitlint over the commit range within the ./app directory
- name: Run commitlint
run: |
git log --oneline ${{ github.event.pull_request.base.ref }}..${{ github.sha }} | npx commitlint
working-directory: ./app