Skip to content

Commit c466ecb

Browse files
committed
Setup JuliaFormatter + reviewdog/action-suggester
1 parent 9dd993e commit c466ecb

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.JuliaFormatter.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
always_for_in = true
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Code style
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
JuliaFormatter:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: julia-actions/setup-julia@v1
12+
- name: Install dependencies
13+
run: |
14+
using Pkg
15+
Pkg.add("JuliaFormatter")
16+
shell: julia --color=yes {0}
17+
- name: Format Julia files
18+
run: |
19+
using JuliaFormatter
20+
21+
base = ENV["GITHUB_BASE_REF"] # "main"
22+
run(`git fetch origin $base`)
23+
24+
cmd = `git diff -z --name-only origin/$base`
25+
files = split(read(cmd, String), '\0')
26+
filter!(endswith(".jl"), files)
27+
28+
println("Formatting:")
29+
foreach(println, files)
30+
31+
format(files)
32+
shell: julia --color=yes --compile=min -O0 {0}
33+
- name: suggester / JuliaFormatter
34+
uses: reviewdog/action-suggester@v1
35+
with:
36+
tool_name: JuliaFormatter

0 commit comments

Comments
 (0)