Added workflow for formatting (#102)

This commit is contained in:
gokul 2021-08-27 10:45:52 -07:00 committed by GitHub
parent 0fb8534191
commit 6dfd669b24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 0 deletions

30
.github/workflows/format.yml vendored Normal file
View File

@ -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 }}

6
.stylua.toml Normal file
View File

@ -0,0 +1,6 @@
column_width = 80
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 4
quote_style = "AutoPreferDouble"
no_call_parentheses = false