This file contains 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: Convert CSV files to Darwin Core compliant event and occurrence files | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
jobs: | |
generate-data: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 # Checkout branch into the runner | |
- uses: r-lib/actions/setup-r@master # Set up R runtime | |
with: | |
r-version: 'release' | |
- name: Setup renv # Set up R env to install packages | |
run: | | |
install.packages('remotes') | |
remotes::install_github("rstudio/renv") | |
shell: Rscript {0} | |
- uses: actions/cache@v2 # Cache packages so won't be compiled everytime job is run | |
with: | |
path: ~/.local/share/renv | |
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} | |
restore-keys: | | |
${{ runner.os }}-renv- | |
- name: Install dependencies # Install the dependencies eg. Dplyr, tidyverse etc | |
run: renv::restore() | |
shell: Rscript {0} | |
- name: Generate data # Run the script | |
run: source("R/data_to_dwc.R") | |
shell: Rscript {0} | |
- name: Commit files # Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add . | |
git diff-index --quiet HEAD || (git commit -m "update data" && git push) |