chore: add check_format.yml
#5
Workflow file for this run
This file contains 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: check_format | |
# yamllint disable-line rule:truthy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
check_format: | |
name: Check format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: julia-actions/setup-julia@v1 | |
with: | |
version: 1.8 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install JuliaFormatter | |
run: | | |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))' | |
- name: Format code | |
run: | | |
git clean -f -x -d | |
julia -e 'using JuliaFormatter; format(".", verbose=true)' | |
- name: Fail if needs reformatting | |
run: | | |
if [[ $(git status --porcelain) ]]; then | |
echo "please reformat these files:" | |
git status --porcelain=v1 | |
exit 1 | |
fi |