Update Truth Data #29
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: Update Truth Data | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 9 * * 1' | |
| jobs: | |
| update_target-data: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 1 | |
| sparse-checkout: | | |
| .github | |
| src | |
| auxiliary-data/target-data_archive | |
| auxiliary-data/data-locations | |
| target-data | |
| - uses: r-lib/actions/setup-r@v2 | |
| - name: Install system dependencies | |
| run: sudo apt-get install libcurl4-openssl-dev libharfbuzz-dev libfribidi-dev libarchive-dev libudunits2-dev libgdal-dev libfontconfig1-dev | |
| - name: Cache R packages | |
| id: cache | |
| if: runner.os != 'Windows' | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ env.R_LIBS_USER }} | |
| key: ${{ runner.os }}-${{ hashFiles('.github/requirements.txt') }}-1 | |
| - name: Install dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: | | |
| R -e 'install.packages(c("dplyr", "tidyr"))' | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate truth csv files | |
| run: | | |
| R -e 'source("src/target-data.R")' | |
| - name: Commit | |
| run: | | |
| git config user.name Github-Actions | |
| git config user.email "<>" | |
| if [ -n "$(git status --porcelain)" ]; then | |
| git add . | |
| git commit -m "Target data update $(date)" | |
| git push | |
| echo "Target data updated"; | |
| else | |
| echo "no updates"; | |
| fi |