forked from beefsack/bgg-ranked-csv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbgg-ranked-csv.sh
More file actions
executable file
·32 lines (25 loc) · 864 Bytes
/
bgg-ranked-csv.sh
File metadata and controls
executable file
·32 lines (25 loc) · 864 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
SAVE_DIR="$(pwd)"
SOURCE_DIR="${HOME}/Recommend.Games/bgg-ranked-csv"
# TODO make argument
DATA_DIR="${HOME}/Recommend.Games/bgg-ranking-historicals"
OUTPUT_FILE="$(date -u '+%Y-%m-%dT%H-%M-%S').csv"
mkdir -p "${DATA_DIR}"
echo "Fetch BGG rankings and write results to <${DATA_DIR}/${OUTPUT_FILE}>"
cd "${SOURCE_DIR}"
set -a; source '.env' || echo 'Unable to read .env'; set +a
./bgg-ranked-csv > "${DATA_DIR}/${OUTPUT_FILE}"
echo "Done fetching."
echo "Commit results to repo <${DATA_DIR}>"
cd "${DATA_DIR}"
git add "${DATA_DIR}/${OUTPUT_FILE}"
git commit --no-gpg-sign \
--message "Added ${OUTPUT_FILE}"
echo "Push new commits to remote repos"
for REMOTE in $(git remote); do
echo "Pushing to <${REMOTE}>"
git push "${REMOTE}" || echo "Unable to push to <${REMOTE}>…"
done
echo "Done."
cd "${SAVE_DIR}"