Skip to content

Feat/auto ci fmt

Feat/auto ci fmt #1674

Workflow file for this run

name: lint
on:
pull_request:
push:
branches:
- master
jobs:
linter:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Install project dependencies
run: yarn install
- name: Lint
run: yarn nx format:check --all
continue-on-error: true # Continue even if the check fails
- name: Check Lint Results
id: lint_result_check
run: |
if [ $? -ne 0 ]; then
echo "lint_failed=true" >> $GITHUB_ENV
else
echo "lint_failed=false" >> $GITHUB_ENV
fi
- name: Auto-format and commit changes if needed
if: ${{ env.lint_failed == 'true' }}
run: |
yarn nx format:write --all
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add .
git commit -m "fmt"
git push