Skip to content

Commit 39f6cdd

Browse files
authored
Create format_check.yml
1 parent fac99c6 commit 39f6cdd

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/format_check.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: format-check
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- release-*
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: julia-actions/setup-julia@latest
14+
with:
15+
version: '1'
16+
- uses: actions/checkout@v4
17+
- name: Format check
18+
shell: julia --color=yes {0}
19+
run: |
20+
using Pkg
21+
# If you update the version, also update the style guide docs.
22+
Pkg.add(PackageSpec(name="JuliaFormatter", version="1"))
23+
using JuliaFormatter
24+
format("src", verbose=true)
25+
format("test", verbose=true)
26+
format("docs", verbose=true)
27+
out = String(read(Cmd(`git diff`)))
28+
if isempty(out)
29+
exit(0)
30+
end
31+
@error "Some files have not been formatted !!!"
32+
write(stdout, out)
33+
exit(1)

0 commit comments

Comments
 (0)