Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 write muskrat data prep scripts #22

Closed
wants to merge 13 commits into from
16 changes: 16 additions & 0 deletions .github/PR_get_muskrat_data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Brief description

This is an **automatically generated PR**.
The following steps are all automatically performed:

- download muskrat management data from gbif
- cleanup and link data with provinces & communes
- export neccessary files

All the steps above are triggered by `./.github/workflows/get_muskrat_data.yaml`<sup>1</sup>
and executed by `./src/get_muskrat_data.R` and assisted by
`./script/install_packages_muskrat.R`.

Changes to the PR description can be made at `./.github/PR_get_muskrat_data.md`

<sup>1</sup>set to trigger every monday between January & December.
81 changes: 81 additions & 0 deletions .github/workflows/get_muskrat_data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
on:
schedule:
- cron: '0 0 * 1-12 1'


name: get_muskrat_data

jobs:
fetch-data:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release'}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_TOKEN: ${{ secrets.AUTOMATISATION }}
gbif_user: ${{ secrets.GBIF_USER }}
email: ${{ secrets.GBIF_EMAIL }}
gbif_pwd: ${{ secrets.GBIF_PWD }}

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.AUTOMATISATION }}

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}

- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2

- name: Install linux libraries
run: |
sudo apt install libsodium-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libgdal-dev libproj-dev
sudo apt install libudunits2-dev

- name: Install R packages
run: |
source("src/install_packages_muskrat.R")
shell: Rscript {0}

- name: Management prep
run: |
source("src/get_muskrat_data.R")
shell: Rscript {0}

- name: Commit and push changes
uses: devops-infra/action-commit-push@master
with:
github_token: ${{ secrets.AUTOMATISATION }}
commit_prefix: "[AUTO]"
commit_message: "get muskrat data"
target_branch: automatic-management-prep

- name: Get branch name
run: |
git branch --show-current

- name: Create pull request
uses: devops-infra/action-pull-request@v0.4.2
with:
github_token: ${{ secrets.AUTOMATISATION }}
target_branch: main
title: "[AUTO] get muskrat data"
template: .github/PR_get_muskrat_data.md
reviewer: SanderDevisscher
label: automated workflow
get_diff: false
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@ vignettes/*.pdf

# R Environment Variables
.Renviron

# too large files
data/interim/df_timeseries.tsv
data/output/full_timeseries.csv
*.zip

Loading