Skip to content

build(repo): run tests in CI #54

build(repo): run tests in CI

build(repo): run tests in CI #54

Workflow file for this run

name: Commitlint
on: [pull_request]
jobs:
lint-commits:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensures commit history is fetched
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18" # Specify a Node.js version
- name: Remove package-lock.json # This is to work around https://github.com/npm/cli/issues/4828
run: rm -f package-lock.json
- name: Install dependencies
run: npm install
env:
GH_NPM_TOKEN: ${{ secrets.GH_NPM_TOKEN }}
- name: Lint last commit message
run: npx commitlint --from=${{ github.event.pull_request.base.sha }} --to=${{ github.event.pull_request.head.sha }} --verbose
- name: Run Prettier
run: lerna run prettify
- name: Run ESLint
run: lerna run lint
- name: Commit and push if changes
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
# Check out the branch
git fetch
git checkout ${{ github.head_ref }}
# Add, commit, and push changes, ignoring package-lock.json
git diff --name-only | grep -v 'package-lock.json' | xargs git add
git diff --staged --quiet || git commit -m "Apply Prettier formatting"
git push origin ${{ github.head_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}