generated from hubverse-org/hubTemplate
-
Notifications
You must be signed in to change notification settings - Fork 12
122 lines (117 loc) · 4.29 KB
/
after-validate-submission.yaml
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: After Validate Submission Workflow
on:
#workflow_run:
# workflows: ["Hub Submission Validation (R)"] # The name of the workflow we want to trigger from
# types:
# - completed
pull_request_target:
types:
- closed
jobs:
copy-files-to-rsv-data-repo:
runs-on: ubuntu-latest
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
if: github.event.pull_request.merged == true
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: r-lib/actions/setup-r@v2
with:
install-r: false
use-public-rspm: true
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
- name: Cache R packages
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ hashFiles('DESCRIPTION') }}
restore-keys: ${{ runner.os }}-r-
- name: Install gh package
run: Rscript -e 'install.packages("gh")'
- name: Install here package
run: Rscript -e 'install.packages("here")'
- name: Install readr package
run: Rscript -e 'install.packages("readr")'
- name: Install lubridate package
run: Rscript -e 'install.packages("lubridate")'
- name: Install ggridges package
run: Rscript -e 'install.packages("ggridges")'
- name: Install forcats package
run: Rscript -e 'install.packages("forcats")'
- name: Install arrow package
run: Rscript -e 'install.packages("arrow")'
- name: Install dplyr package
run: Rscript -e 'install.packages("dplyr")'
- name: Install jsonlite package
run: Rscript -e 'install.packages("jsonlite")'
- name: Install purrr package
run: Rscript -e 'install.packages("purrr")'
- name: Install hubViz
run: |
Rscript -e 'install.packages("remotes")'
Rscript -e 'remotes::install_github("Infectious-Disease-Modeling-Hubs/hubVis")'
- name: Install hubUtils
run: |
Rscript -e 'remotes::install_github("Infectious-Disease-Modeling-Hubs/hubUtils")'
- name: Install hubEnsembles
run: |
Rscript -e 'remotes::install_github("Infectious-Disease-Modeling-Hubs/hubEnsembles")'
- name: Install hubData
run: |
Rscript -e 'remotes::install_github("Infectious-Disease-Modeling-Hubs/hubData")'
- name: Run R script
run: |
cd ./scripts
Rscript ensemble.R
- name: Commit and push new files to root repository
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [ -n "$(git status --porcelain)" ]; then
git add model-output/hub-ensemble/*
git commit -m "Upload new files to root repo"
git push
echo "Data for hub-ensemble uploaded to root repo";
else
echo "no upload for root repo";
fi
shell: bash
- name: Checkout and push to another repository
uses: actions/checkout@v2
with:
#repository: kjsato/rsv-forecast-hub_data
repository: HopkinsIDD/rsv-forecast-hub_data
token: ${{ secrets.KJ3_PATC }}
path: ./rsv-forecast-hub_data
fetch-depth: 2
ref: main
- name: Copy new files
run: |
for FILE in model-output/**/* model-metadata/*; do
if [ -f "$FILE" ]; then
mkdir -p ./rsv-forecast-hub_data/$(dirname $FILE)
cp $FILE ./rsv-forecast-hub_data/$FILE
fi
done
- name: Commit and push new files
run: |
cd ./rsv-forecast-hub_data
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git pull origin main
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Upload new files to RSV data repo"
git push
echo "RSV data uploaded";
else
echo "no upload";
fi
shell: bash