Merge pull request #42 from Vision-null/dev-readMe-formula #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and Format | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
permissions: | |
contents: write | |
jobs: | |
lint-and-format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 2 | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: 20 | |
- name: Setup pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: 9.4.0 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Initial ESLint Check | |
id: lint_check | |
run: pnpm run lint | |
continue-on-error: true | |
- name: Initial Prettier Check | |
id: format_check | |
run: pnpm prettier --check "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}" | |
continue-on-error: true | |
- name: Run ESLint with auto-fix | |
if: steps.lint_check.outcome == 'failure' | |
run: pnpm eslint --fix src/**/*.{js,jsx,ts} | |
- name: Run Prettier with auto-fix | |
if: steps.format_check.outcome == 'failure' | |
run: pnpm prettier --write "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}" | |
- name: Git Auto Commit | |
if: steps.lint_check.outcome == 'failure' || steps.format_check.outcome == 'failure' | |
uses: stefanzweifel/[email protected] | |
with: | |
commit_message: 'style: auto-fix linting and formatting issues' | |
branch: ${{ github.head_ref }} | |
- name: Final ESLint Check | |
if: steps.lint_check.outcome == 'failure' || steps.format_check.outcome == 'failure' | |
run: pnpm run lint | |
- name: Final Prettier Check | |
if: steps.lint_check.outcome == 'failure' || steps.format_check.outcome == 'failure' | |
run: pnpm prettier --check "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}" |