Skip to content

Merge pull request #583 from evo-lua/update-action-versions #1428

Merge pull request #583 from evo-lua/update-action-versions

Merge pull request #583 from evo-lua/update-action-versions #1428

Workflow file for this run

name: Autoformat
on:
pull_request:
paths-ignore:
- "README.MD"
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- main
paths-ignore:
- "README.MD"
- '.gitignore'
jobs:
check-format:
name: Enforce consistent formatting
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
stylua: stylua-linux.zip
exe: ""
- os: macos-latest
stylua: stylua-macos.zip
exe: ""
- os: windows-latest
stylua: stylua-win64.zip
exe: ".exe"
defaults:
run:
shell: bash
steps:
- name: Disable autocrlf # Messes up everything on Windows since the formatter applies \n
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out Git repository
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: false
- name: Set up environment
run: |
set -a
source .github/autoformat.env
cat .github/autoformat.env >> $GITHUB_ENV
echo $(pwd) >> $GITHUB_PATH
- name: Cache clang-format binary
id: cache-clang-format
uses: actions/cache@v4
with:
path: clang-format${{ matrix.exe }}
key: clang-format-${{ runner.os }}-${{ env.EVO_CLANGFORMAT_VERSION }}
restore-keys: |
clang-format-${{ runner.os }}-${{ env.EVO_CLANGFORMAT_VERSION }}
- name: Install clang-format
if: steps.cache-clang-format.outputs.cache-hit != 'true'
run: deps/get-clang-format.sh
- name: Verify clang-format version
run: which clang-format && clang-format --version
- name: Install stylua
run: |
curl --location --output ${{ matrix.stylua }} https://github.com/JohnnyMorganz/StyLua/releases/download/${{ env.EVO_STYLUA_VERSION }}/${{ matrix.stylua }}
unzip ${{ matrix.stylua }}
chmod +x stylua
- name: Verify stylua version
run: which stylua && stylua --version
- name: Run autoformat
run: ./autoformat.sh
- name: Check for inconsistent formatting
run: git --no-pager diff --exit-code -b .