From 92070525e5e9253e213390692a43df047b6ebaa9 Mon Sep 17 00:00:00 2001 From: Gellipapa Date: Sun, 9 Jul 2023 01:30:31 +0200 Subject: [PATCH] :package: Add format-all and editorconfig. --- .editorconfig | 10 ++++++++ .github/workflows/format-all.yml | 43 ++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/workflows/format-all.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..383d3ca5e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +max_line_length = 300 +indent_size = 4 +indent_style = space \ No newline at end of file diff --git a/.github/workflows/format-all.yml b/.github/workflows/format-all.yml new file mode 100644 index 000000000..b94e13427 --- /dev/null +++ b/.github/workflows/format-all.yml @@ -0,0 +1,43 @@ +name: formatter-all + +on: + push: + branches: [ main ] + pull_request: + types: [ labeled ] + +jobs: + formatter: + name: formatter + runs-on: ubuntu-latest + permissions: + contents: write + if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.label.name == 'format_all') }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + fetch-depth: 0 + - uses: actions/setup-node@v3 + with: + node-version: "16" + - name: Install stylua and format files + uses: JohnnyMorganz/stylua-action@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: v0.18.0 + args: -- . + - name: Format files with Prettier + run: | + npx prettier --write '**/*.{ts,js,css,html}' + - name: Update repo before push + run: | + git pull + - name: Commit changes and push current branch + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_user_name: ESX GITHUB ACTIONS BOT + commit_user_email: esx-github-actions-bot@users.noreply.github.com + commit_message: :art:Code formatted in all files