diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index a4ad756..5c9633b 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -1,7 +1,7 @@ name: Build debug-app 'on': workflow_dispatch: - + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..c652e10 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,65 @@ +name: AutoFormat + +on: + push: + paths: + - '**/*' + branches: + - main + pull_request: + paths: + - '**/*' + branches: + - main + workflow_dispatch: + +jobs: + format: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + + - name: Configure Prettier + run: | + echo '{ + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "es5", + "printWidth": 80, + "arrowParens": "always" + }' > .prettierrc + echo '*.min.* + .github/**/* + *-min.* + *.xml' > .prettierignore + + - name: Install Prettier with plugins + run: | + npm i -D prettier prettier-plugin-java + + - name: Format all files + run: | + npx prettier -w **/*.md + npx prettier -w **/*.java --plugin=prettier-plugin-java + + - name: Clean up unnecessary files + run: | + rm -rf node_modules + rm -f package.json + rm -f package-lock.json + rm -f .prettierrc + rm -f .prettierignore + - name: Commit changes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" \ No newline at end of file