49 lines
1.1 KiB
YAML
49 lines
1.1 KiB
YAML
name: Lint
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- id: checkout
|
|
name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- id: setup-node
|
|
name: Setup Node.JS
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
|
|
- id: install-deps
|
|
name: Install dependencies
|
|
run: npm ci
|
|
|
|
- id: lint
|
|
name: Lint code
|
|
run: npm run lint
|
|
|
|
- id: format
|
|
name: Format code
|
|
run: npm run format
|
|
|
|
- id: commit_and_push
|
|
name: Commit and push formatted code
|
|
run: |
|
|
git config --global user.name 'github-actions[bot]'
|
|
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
git add .
|
|
git commit --allow-empty -m "lint and format"
|
|
git push
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|