Skip to content

Commit 003a0cc

Browse files
committed
implement retry in bucket push
1 parent 7c462ba commit 003a0cc

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.github/workflows/archive.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
22
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
33
on:
4-
# push:
5-
# branches:
6-
# - main
4+
push:
5+
branches:
6+
- main
77
schedule:
88
- cron: "0 0 * * 0" # midnight on sunday
99

R/archive.R

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,16 @@ for(i in seq_along(repos)){
6666
file_path
6767
)
6868

69-
# upload to S3
69+
# upload to S3 in retry
7070
cat('\tUpload to S3...\n')
71-
put_object(file_path, bucket = 'tbep-tech-github-backup', multipart = T)
71+
buck <- 'tbep-tech-github-backup'
72+
tryCatch(
73+
put_object(file_path, bucket = buck, multipart = T),
74+
error = function(e){
75+
cat('\t\tRetrying...\n')
76+
put_object(file_path, bucket = buck, multipart = T)
77+
}
78+
)
7279

7380
# remove local file
7481
file.remove(file_path)

0 commit comments

Comments
 (0)