-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (58 loc) · 1.75 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Lint
on:
- push
- pull_request
jobs:
lint-fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use OCaml 5.2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 5.2
dune-cache: true
allow-prerelease-opam: true
- name: Lint fmt
uses: ocaml/setup-ocaml/lint-fmt@v3
- name: Format code
run: |
git ls-files '*.ml' '*.mli' | xargs opam exec -- ocamlformat --inplace
- name: Check for modified files
id: git-check
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT
- name: Commit and push changes
if: ${{ steps.git-check.outputs.modified == 'true' }}
run: |
git config --global user.name "Automated ocamlformat GitHub action, developed by robur.coop"
git config --global user.email "[email protected]"
git add -A
git commit -m "formatted code"
git push
lint-opam:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use OCaml 5.2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 5.2
dune-cache: true
allow-prerelease-opam: true
- name: Lint opam
uses: ocaml/setup-ocaml/lint-opam@v3
lint-doc:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use OCaml 5.2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 5.2
dune-cache: true
allow-prerelease-opam: true
- name: Lint doc
uses: ocaml/setup-ocaml/lint-doc@v3