feat: Add commit lint check workflow #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- name: Install dependencies | |
run: npm ci | |
working-directory: ./app | |
# Fetch and merge the base branch (ensure all 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 entire range of the PR | |
- name: Run commitlint | |
run: | | |
git log --oneline ${{ github.event.pull_request.base.ref }}..${{ github.sha }} | npx commitlint |