Chore adding autofix ci #4
Workflow file for this run
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: autofix.ci | |
on: | |
pull_request: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
autofix: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install --no-frozen-lockfile | |
- name: Cache pnpm modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm- | |
- name: Format code with Prettier | |
run: | | |
pnpm exec prettier --write "**/*.{js,jsx,ts,tsx,json,md}" | |
git add . | |
- name: Run ESLint fix | |
run: | | |
pnpm exec eslint . --ext .js,.jsx,.ts,.tsx --fix | |
git add . | |
- name: Check TypeScript | |
run: | | |
pnpm exec tsc --noEmit | |
continue-on-error: true | |
- name: Sort package.json | |
run: | | |
pnpm exec sort-package-json | |
git add package.json | |
- name: Commit changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
if [ -n "$(git status --porcelain)" ]; then | |
git commit -m "style: 🎨 auto format and fix" -m "Co-authored-by: ${{ github.event.pull_request.user.login }} <${{ github.event.pull_request.user.id }}+${{ github.event.pull_request.user.login }}@users.noreply.github.com>" | |
fi | |
- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a |