forked from HopkinsIDD/rsv-forecast-hub
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (50 loc) · 2.26 KB
/
copy_rsv_data.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
name: Copy RSV target-data
on:
workflow_dispatch:
schedule:
- cron: '10 9 * * 5'
# 10 minites after started update-rsv-data on rsv-forecast-hub
jobs:
copy-files:
runs-on: ubuntu-latest
name: Copy Files
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 1
path: ./rsv-forecast-hub
- name: Remove old rsvnet hospitalization data
run: rm ./rsv-forecast-hub/target-data/*_rsvnet_hospitalization.csv || true
- name: Copy files
run: |
mkdir -p ./rsv-forecast-hub/target-data/archive/
chmod +w ./rsv-forecast-hub/target-data/
FILES=$(curl -s https://api.github.com/repos/midas-network/rsv-scenario-modeling-hub/git/trees/main?recursive=1 | jq -r '.tree[] | select(.path | startswith("target-data/")) | .path')
for file in $FILES
do
FILENAME=$(basename $file)
if [[ $file == *_rsvnet_hospitalization.csv && $file != *archive* ]]; then
if [[ ! -f ./rsv-forecast-hub/target-data/$FILENAME ]]; then
curl -o ./rsv-forecast-hub/target-data/$FILENAME https://raw.githubusercontent.com/midas-network/rsv-scenario-modeling-hub/main/$file
fi
elif [[ $file == *_rsvnet_hospitalization.csv && $file == *archive* ]]; then
if [[ ! -f ./rsv-forecast-hub/target-data/archive/$FILENAME ]]; then
curl -o ./rsv-forecast-hub/target-data/archive/$FILENAME https://raw.githubusercontent.com/midas-network/rsv-scenario-modeling-hub/main/$file
fi
fi
done
- name: Commit and push repository update
run: |
cd ./rsv-forecast-hub
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 .
git commit -m "Download truth data file from RSV repo"
git push
last_commit=$(git rev-parse HEAD)
echo "RSV-Net data updated";
else
echo "no updates";
fi