save #1
This file contains 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: 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 '# Ignore all minified files | |
*.min.* | |
.github/**/* | |
*-min.*' > .prettierignore | |
- name: Install Prettier with plugins | |
run: | | |
npm i -D prettier prettier-plugin-java prettier-plugin-kotlin | |
- name: Format all files | |
run: | | |
npx prettier -w . | |
- 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 "[email protected]" |