-
Notifications
You must be signed in to change notification settings - Fork 3
/
clean_all_rosters.R
28 lines (21 loc) · 1.01 KB
/
clean_all_rosters.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
source("combine_roster_data.R")
# run this every thurs early in morning
if (lubridate::month(lubridate::today()) %in% c(9, 10, 11, 12, 1, 2)) {
suppressWarnings(
roster <- combine_roster_data("2020-09-10")
)
saveRDS(roster, 'roster/roster_cleaned.rds')
#github setup stuff
if (grepl("Documents",getwd())){
path <- ".."
} else { ### server
path <- "/home/ben"
}
password = as.character(read.delim(glue::glue('{path}/gh.txt'))$pw)
data_repo <- git2r::repository('./') # Set up connection to repository folder
git2r::add(data_repo,'roster/*') # add specific files to staging of commit
git2r::commit(data_repo, message = glue::glue("Updating at {Sys.time()}")) # commit the staged files with the chosen message
git2r::pull(data_repo) # pull repo (and pray there are no merge commits)
git2r::push(data_repo, credentials = git2r::cred_user_pass(username = 'guga31bb', password = paste(password))) # push commit
message(paste('Successfully uploaded to GitHub at',Sys.time()))
}