-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathno-git-diff.sh
executable file
·39 lines (30 loc) · 1.11 KB
/
no-git-diff.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
RED=$'\e[31m'
GREEN=$'\e[32m'
BLUE=$'\e[34m'
LIGHT_BLUE=$'\e[94m'
ITALIC=$'\e[3m'
BOLD=$'\e[1m'
ENDCOLOR=$'\e[0m'
green() { echo "${GREEN}$1${ENDCOLOR}" ; }
red() { echo "${RED}$1${ENDCOLOR}" ; }
lightBlue() { echo "${LIGHT_BLUE}$1${ENDCOLOR}" ; }
code() { echo "'${LIGHT_BLUE}$1${ENDCOLOR}'" ; }
italic() { echo "${ITALIC}$1${ENDCOLOR}"; }
####################################################
lightBlue "Checking for git diffs..."
italic ""
italic "Using $(code 'git diff --exit-code') aids in ensuring stability of our commands to reduce flakiness in CI."
italic ""
italic "If you see an error from this task, please check the command(s) from the previous step(s) and try running them locally."
italic "To fix, you will need to either commit the changes or add new files to the local per-project .gitignore file."
italic ""
italic ""
git diff --exit-code
if [ $? -ne 0 ]; then
red "Git diff detected. Note what changed above."
red "Please check the command(s) from the previous step(s) that produced the diff."
exit 1
else
green "✨ Congrats, the repo has no changed files at the moment. ✨"
fi