Created
February 25, 2024 21:10
-
-
Save aiKrice/8f594e4b906142895b3e18497269c9c7 to your computer and use it in GitHub Desktop.
AndroidLint + terminal-notifier: pre-commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Get kotlin files that are staged | |
| staged_files=$(git diff --cached --name-only --diff-filter=d | grep ".kt$") | |
| # Check if we have didn't edit any souce files | |
| if [[ "$staged_files" = "" ]]; then | |
| echo "AndroidLint skipped: No source files to format." | |
| exit 0 | |
| fi | |
| echo "🔵 Linting code with AndroidLint ..." | |
| ./gradlew lint | |
| if [ $? -ne 0 ]; then | |
| terminal-notifier -title "🔴 Periphery failed" -message "Message detail here under title" \ | |
| -sound Submarine -group 12 -remove 12 -activate "com.google.android.studio"\ | |
| -contentImage youAppLogo.png -ignoreDnD | |
| exit 1 | |
| fi | |
| terminal-notifier -title "🟢 Commit successful" -message "Click here to push"\ | |
| -sound defaut -group 12 -remove 12 -activate "bundleid.of.app.to.display.on.tap"\ | |
| -execute "cd $currentDirectory && git push -f" -contentImage youAppLogo.png -ignoreDnD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment