File tree 3 files changed +33
-4
lines changed
3 files changed +33
-4
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # Store files that are about to be committed
4
+ staged_files=$( git diff --cached --name-only --diff-filter=d | grep .ex$)
5
+
6
+ if [ -n " $staged_files " ]; then
7
+ echo " Running mix format on staged Elixir files..."
8
+
9
+ # Run mix format
10
+ mix format
11
+
12
+ # Add the formatted files back to staging
13
+ echo " $staged_files " | while read file; do
14
+ if [ -f " $file " ]; then
15
+ git add " $file "
16
+ fi
17
+ done
18
+ fi
19
+
20
+ # Run format check to ensure everything is formatted
21
+ mix format --check-formatted
22
+ if [ $? -ne 0 ]; then
23
+ echo " ❌ Code must be properly formatted before committing."
24
+ echo " Please stage the formatting changes and try again."
25
+ exit 1
26
+ fi
27
+
28
+ echo " ✅ Code formatting check passed."
29
+ exit 0
Original file line number Diff line number Diff line change 18
18
- name : Set up Elixir
19
19
uses : erlef/setup-beam@v1
20
20
with :
21
- elixir-version : ' 1.14 .x'
22
- otp-version : ' 25 .x'
21
+ elixir-version : ' 1.18 .x'
22
+ otp-version : ' 27 .x'
23
23
24
24
- name : Cache deps
25
25
uses : actions/cache@v3
Original file line number Diff line number Diff line change 15
15
- name : Set up Elixir
16
16
uses : erlef/setup-beam@v1
17
17
with :
18
- elixir-version : ' 1.14 .x'
19
- otp-version : ' 25 .x'
18
+ elixir-version : ' 1.18 .x'
19
+ otp-version : ' 27 .x'
20
20
21
21
- name : Install dependencies
22
22
run : mix deps.get
You can’t perform that action at this time.
0 commit comments