Skip to content

fix(workflows): adjust commitlint script formatting for clarity #1492

fix(workflows): adjust commitlint script formatting for clarity

fix(workflows): adjust commitlint script formatting for clarity #1492

Workflow file for this run

name: cohort360-frontend-commitlint
on:
pull_request:
branches:
- develop
- main
types: [opened, synchronize, reopened, ready_for_review, edited]
permissions:
contents: read
pull-requests: read
jobs:
commit-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Install commit-lint
run: |
npm install --ignore-scripts --force conventional-changelog-conventionalcommits @commitlint/config-conventional commitlint@latest
- name: Fix commitlint error
run: |
sed -i 's/"type": "module",//g' package.json
- name: Validate PR commits with commitlint
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
git fetch origin "$BASE_REF"
FROM=$(git merge-base "origin/$BASE_REF" "$HEAD_SHA")
npx commitlint --from "$FROM" --to "$HEAD_SHA" --verbose
- name: Validate PR title with commitlint
run: |
echo "${{ github.event.pull_request.title }}" | npx commitlint