Skip to content

Commit

Permalink
chore: add ci pipeline to format code
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue committed Nov 17, 2023
1 parent 9194553 commit 61e7593
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Fix

on:
push:
branches-ignore:
- 'main'
- 'dev'

jobs:
format:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Cache ~/.pnpm-store
uses: actions/cache@v3
env:
cache-name: cache-pnpm-store
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.node-version }}-test-
${{ runner.os }}-
- name: Install pnpm
run: corepack enable

- name: Install deps
run: pnpm i

- name: Format
run: pnpm run format

- name: Commit files and push
continue-on-error: true
if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add --all
git commit -m "chore(ci): [bot] format code"
git push
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"build": "tsup src/cli-*.ts src/index.ts src/rollup.ts --clean --splitting",
"prepublishOnly": "npm run build",
"test": "npm run build && npm run test-only",
"format": "prettier --write .",
"test-only": "vitest run",
"build-fast": "npm run build -- --no-dts"
},
Expand Down

0 comments on commit 61e7593

Please sign in to comment.