Fetch Data #929
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Fetch Data | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 8 * * *' # action runs everyday at 08:00 in the UK | |
| jobs: | |
| fetch: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: pip install beautifulsoup4 requests pandas | |
| - name: Run Bookwyrm scrape script | |
| env: | |
| bookwyrm_localname: ${{ secrets.bookwyrm_localname }} | |
| bookwyrm_password: ${{ secrets.bookwyrm_password }} | |
| run: python scripts/get_books.py "$bookwyrm_localname" "$bookwyrm_password" | |
| - name: Run iNaturalist API and processing scripts | |
| run: | | |
| python scripts/update_inat_obs.py # update observation database | |
| python scripts/update_inat_tax.py # update taxonomy database | |
| sed 's/\\u/ u/g' _data/inat_taxonomy.json > _data/inat_taxonomy2.json # remove emojis from json | |
| mv _data/inat_taxonomy2.json _data/inat_taxonomy.json # | |
| python scripts/process_inat.py # find most recent new taxa | |
| - name: Commit and push | |
| run: | | |
| git add . | |
| git config --global user.email "github-actions[bot]" | |
| git config --global user.name "github-actions[bot]@users.noreply.github.com" | |
| # don't try to push if there's no change (&&/|| syntax avoids exit code 1 causing report that workflow 'failed') | |
| git commit -am "automated Github Actions data update" && git push || echo "nothing to push" |