Skip to content

Commit 0b9f443

Browse files
authored
Create format_check.yml
1 parent 981a0d7 commit 0b9f443

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/format_check.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
Pkg.add(PackageSpec(name="JuliaFormatter", version="1"))
22+
using JuliaFormatter
23+
format(".", verbose=true)
24+
out = String(read(Cmd(`git diff`)))
25+
if isempty(out)
26+
exit(0)
27+
end
28+
@error "Some files have not been formatted !!!"
29+
write(stdout, out)
30+
exit(1)

0 commit comments

Comments
 (0)