Browse Source

Auto fix PRs that fail Prettier

Alec Rust 2 years ago
parent
commit
bfd8c91f4e
1 changed files with 13 additions and 1 deletions
  1. 13 1
      .github/workflows/lint.yml

+ 13 - 1
.github/workflows/lint.yml

@@ -48,9 +48,21 @@ jobs:
       - name: Install Node packages
       - name: Install Node packages
         run: npm ci --ignore-scripts
         run: npm ci --ignore-scripts
 
 
-      - name: Run Prettier
+      - name: Check formatting
         run: npx prettier --check .
         run: npx prettier --check .
 
 
+      - name: Apply formatting
+        if: github.event_name == 'pull_request'
+        run: npm run format
+
+      - name: Commit formatting changes
+        if: github.event_name == 'pull_request'
+        uses: EndBug/add-and-commit@v9
+        with:
+          default_author: github_actions
+          message: Apply Prettier formatting
+          add: "."
+
   eslint:
   eslint:
     name: ESLint
     name: ESLint
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest