forked from theshteves/commit-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.sh
51 lines (42 loc) · 1 KB
/
bot.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
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
#
# Commit Bot by Steven Kneiser
#
# > https://github.com/theshteves/commit-bot
#
# Deploy locally by adding the following line to your crontab:
# 0 22 * * * /bin/bash /<full-path-to-your-folder>/code/commit-bot/bot.sh
#
# Edit your crontab in vim w/ the simple command:
# crontab -e
#
# Deploying just on your computer is better than a server if you want
# your commits to more realistically mirror your computer usage.
#
# ...c'mon, nobody commits EVERY day ;)
#
info="Commit: $(date)"
os="$(uname -s)"
echo "commit-bot detects OS: $os"
case $os in
Darwin)
cd "`dirname $0`" || exit 1
;;
Linux)
cd "$(dirname "$(readlink -f "$0")")" || exit 1
;;
CYGWIN*|MINGW32*|MSYS*|MINGW*)
echo "OS unsupported (submit an issue on GitHub!)"
;;
*)
echo "OS unsupported (submit an issue on GitHub!)"
;;
esac
echo "$info" >> output.txt
echo "$info"
echo
# Ship it
git add output.txt
git commit -m "$info"
git push origin master
cd -