Skip to content

ADG-414 Improve code quality with github actions #5

ADG-414 Improve code quality with github actions

ADG-414 Improve code quality with github actions #5

Workflow file for this run

name: Code Quality checks
on:
pull_request:
push:
branches: [main]
jobs:
code-quality:
name: Run linter and prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install dependencies
run: npm ci
- name: ES syntax linter
run: npm run lint -- --fix
- name: Prettier
run: npm run prettier -- --write
- name: Check for changes
id: changes
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
git diff --exit-code || echo "Changes detected"
- name: Commit changes (if any)
if: steps.changes.outcome == 'failure'
run: |
git add .
git commit -m "Auto-format code" || echo "No changes to commit"
- name: Push changes
if: steps.changes.outcome == 'failure'
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}