update Dec24 #85
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
on: | |
push: | |
branches: [main, master] | |
paths: | |
- data/raw/**/*.xlsx | |
- report/markdown/** | |
name: build_report | |
jobs: | |
build_report: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: windows-latest, r: 'release'} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
RSPM: ${{ matrix.config.rspm }} | |
GITHUB_PAT: ${{ secrets.GH_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
- uses: r-lib/actions/setup-pandoc@v2 | |
with: | |
pandoc-version: '2.19.2' # Version on Liam's Mac. We know this works | |
- name: Install dependencies | |
run: | | |
install.packages("drat") | |
drat::addRepo("hyenaproject") | |
install.packages("hyenaR") | |
install.packages("remotes") | |
### Include auth_token that is ONLY for access public repos. | |
remotes::install_github("hyenaproject/NgoroWeather", subdir = "pkg", dependencies = TRUE) | |
shell: Rscript {0} | |
- name: Build pdf report | |
run: | | |
install.packages("tinytex") | |
tinytex::install_tinytex() | |
rmarkdown::render(input = "./report/markdown/NCAA_weather_report_pdf.Rmd", output_dir = "./report", output_file = "NCAA_weather_report_Hyena_Project.pdf") | |
shell: Rscript {0} | |
- name: Build summary data | |
run: | | |
library(NgoroWeather) | |
NgoroWeather::load_package_database.weather(input.folder = "./data/raw", overwrite.db = "yes") | |
output <- NgoroWeather::create_crater_weather.summary.table(variable = NULL) | |
## Remove .csv files from this folder | |
current_csv <- list.files("./data/summary", pattern = ".csv", full.names = TRUE) | |
file.remove(current_csv) | |
## Save new file | |
write.csv(output, file = paste0("./data/summary/weatherdata_summary_", Sys.Date(), ".csv"), row.names = FALSE) | |
shell: Rscript {0} | |
- name: check for changes | |
run: git status | |
- name: stage changed files | |
run: git add -A | |
- name: commit changed files | |
run: | | |
git config user.email liam.bailey@liamdbailey.com | |
git commit -m "Auto updating report" | |
- name: push code to master | |
run: git push |