From 8ae09aa9a1bbd0376d51483b4134d968b242863e Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Tue, 3 Jan 2023 22:02:09 -0600 Subject: [PATCH] Add linting workflow for PRs --- .github/workflows/linting.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/linting.yml diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..08a30e9 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,29 @@ +name: Code format checker +on: + push: + branches: + - master + pull_request: + +jobs: + lint: + name: JuliaFormatter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: julia-actions/setup-julia@v1 + with: + version: "1" + - run: | + julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))' + julia -e 'using JuliaFormatter; format(".", verbose=true)' + - run: | + julia -e ' + out = Cmd(`git diff --name-only`) |> read |> String + if out == "" + exit(0) + else + @error "Some files have not been formatted !!!" + write(stdout, out) + exit(1) + end'