| ... | @@ -1,29 +0,0 @@ |
| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | most_recent='' |
| 6 | |
| 7 | while true |
| 8 | do |
| 9 | commits=$(curl -s https://api.github.com/repos/$1/commits) |
| 10 | sha=$(echo "$commits" | jq -r '.[0].sha') |
| 11 | |
| 12 | if [ -z "$most_recent" ] |
| 13 | then |
| 14 | most_recent="$sha" |
| 15 | echo "first run of loop, commit is $sha" |
| 16 | continue |
| 17 | fi |
| 18 | |
| 19 | if [ "$most_recent" == "$sha" ] |
| 20 | then |
| 21 | echo "most recent commit is the same, sleeping" |
| 22 | # sec - min - hr |
| 23 | sleep $((1 * 60 * 60 * $2)) |
| 24 | continue |
| 25 | fi |
| 26 | |
| 27 | echo "found new commit $sha" |
| 28 | ./generate.sh |
| 29 | done |