Skip to content

chore: optimize commit lint #144

chore: optimize commit lint

chore: optimize commit lint #144

Workflow file for this run

name: checker
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
commitlint:
environment: commitlint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install commitlint
run: |
npm install -g commitlint@latest @commitlint/{config-conventional,cli}@latest
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --last --verbose
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
lint-and-test:
environment: lint-and-test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Run Prettier
run: npm run prettier
- name: Run Lint
run: npm run lint
- name: Run Test
run: npm run test