From 828217b9da4a2b6def830e871f0f467e05d2424f Mon Sep 17 00:00:00 2001 From: ashincoder <83629316+ashincoder@users.noreply.github.com> Date: Fri, 27 Aug 2021 08:57:58 +0530 Subject: [PATCH] feat: Added gh action formatter --- .github/workflows/format.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..b9cfe24 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,30 @@ +name: format + +on: + push: + paths: '**.lua' + branches: [main, dev] + +jobs: + stylua: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup and run stylua + uses: JohnnyMorganz/stylua-action@1.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --config-path=./.stylua.toml -g *.lua -g !lua/core/**/*.lua -g !lua/modules/**/*.lua -g !lua/utils/*.lua -- . + - name: Commit files + run: | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + if [[ ! -z $(git status -s) ]]; then + git add . + git commit -m "chore: format source code" + fi + - name: Push formatted files + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }}