forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup JuliaFormatter + reviewdog/action-suggester
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
always_for_in = true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Code style | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
JuliaFormatter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@v1 | ||
- name: Install dependencies | ||
run: | | ||
using Pkg | ||
Pkg.add("JuliaFormatter") | ||
shell: julia --color=yes {0} | ||
- name: Format Julia files | ||
run: | | ||
using JuliaFormatter | ||
base = ENV["GITHUB_BASE_REF"] # "main" | ||
run(`git fetch origin $base`) | ||
cmd = `git diff -z --name-only origin/$base` | ||
files = split(read(cmd, String), '\0') | ||
filter!(endswith(".jl"), files) | ||
println("Formatting:") | ||
foreach(println, files) | ||
format(files) | ||
shell: julia --color=yes --compile=min -O0 {0} | ||
- name: suggester / JuliaFormatter | ||
uses: reviewdog/action-suggester@v1 | ||
with: | ||
tool_name: JuliaFormatter |