Skip to content

Instantly share code, notes, and snippets.

@wendreof
Last active June 18, 2022 20:18
Show Gist options
  • Save wendreof/920ec6d711eb9a5b8b5ee33208cad1c2 to your computer and use it in GitHub Desktop.
Save wendreof/920ec6d711eb9a5b8b5ee33208cad1c2 to your computer and use it in GitHub Desktop.
.Net Hooks
#!/bin/sh
echo "Formattng the .cs files changed... ✨✨✨"
# Valida HoosPath
git config core.hooks
# Format the code
FILES=$(git diff --cached --name-only --diff-filter=ACM "*.cs")
if [ -n "$FILES" ]
then
dotnet-format webApi_Pix.sln --include $FILES
echo "$FILES" | xargs git add
fi
if [ $? -ne 0 ]; then
echo "Wasn't possible format your changes...."
exit 1
fi
echo "Formatting done 😎😎"
exit 0
#!/bin/sh
echo "Building before push ⚒️⚒️⚒️"
dotnet build
echo "Build done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment