fix #538 #8
This file contains hidden or 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: Prettier Autofix | |
| on: | |
| push: | |
| branches: ["**"] | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| contents: write | |
| jobs: | |
| prettier: | |
| if: github.actor != 'github-actions[bot]' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Run Prettier | |
| run: npx prettier --write "kubejs/**/*.{js,json}" | |
| continue-on-error: false | |
| - name: Commit changes | |
| if: github.event_name == 'push' | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "chore: prettier formatting" | |
| - name: Check for formatting changes | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| if ! git diff --exit-code; then | |
| echo "::notice::Some files are not properly formatted. You may want to run prettier locally. This will also get auto fixed on commit." | |
| else | |
| echo "::notice::All files are properly formatted." | |
| fi |