File tree 1 file changed +32
-11
lines changed
1 file changed +32
-11
lines changed Original file line number Diff line number Diff line change 1
- name : Formatter
1
+ name : format-check
2
2
3
- on : [pull_request]
3
+ on :
4
+ push :
5
+ branches :
6
+ - ' main'
7
+ tags : ' *'
8
+ pull_request :
4
9
5
10
jobs :
6
11
build :
7
- runs-on : ubuntu-latest
12
+ runs-on : ${{ matrix.os }}
13
+ strategy :
14
+ matrix :
15
+ julia-version : [1]
16
+ julia-arch : [x86]
17
+ os : [ubuntu-latest]
8
18
steps :
19
+ - uses : julia-actions/setup-julia@latest
20
+ with :
21
+ version : ${{ matrix.julia-version }}
22
+
9
23
- uses : actions/checkout@v4
10
- - uses : julia-actions/cache@v2
11
24
- name : Install JuliaFormatter and format
25
+ # This will use the latest version by default but you can set the version like so:
26
+ #
27
+ # julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
28
+ run : |
29
+ julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
30
+ julia -e 'using JuliaFormatter; format(".", verbose=true)'
31
+ - name : Format check
12
32
run : |
13
- julia -e 'import Pkg; Pkg.add("JuliaFormatter")'
14
33
julia -e '
15
- using JuliaFormatter
16
- result = format(".")
17
- if result == false
18
- error("Formatting failed")
19
- end
20
- '
34
+ out = Cmd(`git diff`) |> read |> String
35
+ if out == ""
36
+ exit(0)
37
+ else
38
+ @error "Some files have not been formatted !!!"
39
+ write(stdout, out)
40
+ exit(1)
41
+ end'
You can’t perform that action at this time.
0 commit comments