Skip to content

Commit

Permalink
Daily refresh CSV using Circle CI
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Mar 13, 2019
1 parent ca66d9a commit 4b55742
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,35 @@
version: 2
jobs:
fetch_and_commit:
docker:
- image: circleci/python:3.6.4
steps:
- checkout
- run:
command: |
cp Street_Tree_List.csv Street_Tree_List-old.csv
curl -o Street_Tree_List.csv "https://data.sfgov.org/api/views/tkzw-k3nq/rows.csv?accessType=DOWNLOAD"
git add Street_Tree_List.csv
git config --global user.email "treebot@example.com"
git config --global user.name "Treebot"
sudo pip install csv-diff
csv-diff Street_Tree_List-old.csv Street_Tree_List.csv --key=TreeID > message.txt
git commit -F message.txt && \
git push -q https://${GITHUB_PERSONAL_TOKEN}@github.com/simonw/sf-tree-history.git master \
|| true
workflows:
version: 2
build:
jobs:
- fetch_and_commit
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- fetch_and_commit
5 changes: 5 additions & 0 deletions README.md
@@ -0,0 +1,5 @@
# sf-tree-history

Tracking the history of trees in San Francisco.

This repository [uses CircleCI](https://circleci.com/gh/simonw/sf-tree-history) to retrieve the [official CSV file of trees in San Francisco](https://data.sfgov.org/City-Infrastructure/Street-Tree-List/tkzw-k3nq) once a day and track any changes to it over time using the git commit history.

0 comments on commit 4b55742

Please sign in to comment.