diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml new file mode 100644 index 0000000..2aa75a4 --- /dev/null +++ b/.github/workflows/prettier.yml @@ -0,0 +1,39 @@ +name: Prettier + +on: [push, pull_request] + +jobs: + prettier: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache Node.js modules + uses: actions/cache@v2 + with: + path: | + node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "18" + + - name: Install dependencies + run: npm install + + - name: Format code + run: npx prettier --write . + + - name: Commit and push changes + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git add . + git commit -m "Format code with Prettier" + git push