From 6dfd669b240d27bc8744462d50407b77d31d2131 Mon Sep 17 00:00:00 2001 From: gokul <33443763+JavaCafe01@users.noreply.github.com> Date: Fri, 27 Aug 2021 10:45:52 -0700 Subject: [PATCH] Added workflow for formatting (#102) --- .github/workflows/format.yml | 30 ++++++++++++++++++++++++++++++ .stylua.toml | 6 ++++++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/format.yml create mode 100644 .stylua.toml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..eeaed0d --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,30 @@ +name: format + +on: + pull_request: + branches: + - "master" + +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 !*.spec.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 "Auto: format source code" + fi + - name: Push formatted files + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..9a32f44 --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 80 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 4 +quote_style = "AutoPreferDouble" +no_call_parentheses = false