push #70
This file contains hidden or 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: Formatting | |
on: | |
push: | |
branches: [main] # or any branch you want to watch | |
paths: | |
- '**.lua' | |
pull_request: | |
paths: | |
- '**.lua' | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Lua | |
uses: leafo/gh-actions-lua@v9 | |
- name: Install Stylua | |
run: | | |
curl -L https://github.com/JohnnyMorganz/StyLua/releases/latest/download/stylua-linux-x86_64.zip -o stylua.zip | |
unzip stylua.zip -d stylua-bin | |
sudo mv stylua-bin/stylua /usr/local/bin/ | |
stylua --version | |
- name: Run Stylua formatter | |
run: | | |
stylua . | |
- name: Commit formatted code (if changed) | |
run: | | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git add . | |
git diff --cached --quiet || git commit -m "chore: auto-format Lua code with Stylua" | |
git push |