File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ set -e # Exit immediately if a command exits with a non-zero status.
4
+
5
+ # Function to check for git changes and commit if necessary.
6
+ commit_if_changes () {
7
+ if [ -n " $( git status --porcelain) " ]; then
8
+ echo " changes detected, committing..."
9
+ git commit --allow-empty -am " $1 "
10
+ echo " commit created."
11
+ fi
12
+ }
13
+
14
+ # Step 1: Run cargo check and commit changes to Cargo.lock if any.
15
+ cargo check --workspace
16
+ commit_if_changes " commit Cargo.lock"
17
+
18
+ # Step 2: Run cargo clippy with fixes and commit changes if any.
19
+ cargo clippy --fix --workspace --all-features
20
+ commit_if_changes " cargo clippy"
21
+
22
+ # Step 3: Run cargo fix and commit changes if any.
23
+ cargo fix --workspace --all-features --all-targets
24
+ commit_if_changes " cargo fix"
25
+
26
+ # Step 4: Run cargo fmt and commit changes if any.
27
+ cargo fmt
28
+ commit_if_changes " cargo fmt"
You can’t perform that action at this time.
0 commit comments