-
Notifications
You must be signed in to change notification settings - Fork 1
/
pre-push
executable file
·54 lines (44 loc) · 1.32 KB
/
pre-push
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
set -e
[ -n "$NO_HOOK" ] && exit 0
[ -n "$WECHATY_INNER_PRE_HOOK" ] && {
# http://stackoverflow.com/a/21334985/1123955
exit 0
}
npm run lint
[ -z "$CYGWIN" ] && {
npm version patch
WECHATY_INNER_PRE_HOOK=1 git push
cat <<'_STR_'
____ _ _ ____ _
/ ___(_) |_ | _ \ _ _ ___| |__
| | _| | __| | |_) | | | / __| '_ \
| |_| | | |_ | __/| |_| \__ \ | | |
\____|_|\__| |_| \__,_|___/_| |_|
____ _ _
/ ___| _ _ ___ ___ ___ ___ __| | |
\___ \| | | |/ __/ __/ _ \/ _ \/ _` | |
___) | |_| | (_| (_| __/ __/ (_| |_|
|____/ \__,_|\___\___\___|\___|\__,_(_)
_STR_
echo
echo
echo
echo " ### Npm verion bumped and pushed by inner push inside hook pre-push ###"
echo " ------- vvvvvvv outer push will be canceled, never mind vvvvvvv -------"
echo
echo
echo
exit 127
}
# must run this after the above `test` ([ -z ...]),
# or will whow a error: error: failed to push some refs to 'git@github.com:wechaty/wechaty.git'
echo "PRE-PUSH HOOK PASSED"
echo