aboutsummaryrefslogtreecommitdiff
path: root/bot/sx-bot.sh
blob: 9bd7f2cf373051612aa56801c2d142145da5891a (plain) (blame)
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
#!/usr/bin/env bash

DESTINATION_BRANCH=gh-pages
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)

function notify-done {
    local title
    local message
    title="SX Tag Bot"
    message="Finished retrieving tag lists"
    case $(uname | tr '[[:upper:]]' '[[:lower:]]') in
        darwin)
            terminal-notifier \
                -message ${message} \
                -title ${title} \
                -sound default
            ;;
        *)
            echo ${message}
    esac
}

function generate-tags {
    emacs -Q --batch \
          -L "./" -L "./bot/" -l sx-bot \
          -f sx-bot-fetch-and-write-tags
    ret=$?
    notify-done
    return ${ret}
}

git checkout ${DESTINATION_BRANCH} &&
    git pull &&
    generate-tags &&
    git stage data/ &&
    git commit -m "Update tag data" &&
    git push &&
    echo 'Bot finished.'

git checkout ${CURRENT_BRANCH}