Git pre-commit and pre-push actions
This commit is contained in:
7
.husky/pre-commit
Executable file
7
.husky/pre-commit
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
STAGED_CS=`git diff --cached --name-only --diff-filter=ACMR --pickaxe-regex "*.cs" | tr '\n' ';'`
|
||||
|
||||
dotnet husky run --group pre-commit --args $STAGED_CS
|
||||
|
||||
7
.husky/pre-push
Executable file
7
.husky/pre-push
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
## husky task runner examples -------------------
|
||||
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'
|
||||
|
||||
dotnet husky run --group pre-push
|
||||
31
.husky/task-runner.json
Normal file
31
.husky/task-runner.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "https://alirezanet.github.io/Husky.Net/schema.json",
|
||||
"tasks": [
|
||||
{
|
||||
"name": "Run Tests",
|
||||
"group": "pre-push",
|
||||
"command": "dotnet",
|
||||
"args": [
|
||||
"test",
|
||||
"PkmnLib.Tests/PkmnLib.Tests.csproj",
|
||||
"--verbosity",
|
||||
"minimal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "JB Code Style",
|
||||
"group": "pre-commit",
|
||||
"command": "dotnet",
|
||||
"pathMode": "relative",
|
||||
"filteringRule": "staged",
|
||||
"args": [
|
||||
"jb",
|
||||
"cleanupcode",
|
||||
"PkmnLib.NET.sln",
|
||||
"--profile=Built-in: Reformat & Apply Syntax Style",
|
||||
"--include=${args}"
|
||||
],
|
||||
"include": ["**/*.cs"]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user