forked from european-modelling-hubs/ari-forecast-hub_archive
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (64 loc) · 2.12 KB
/
ensemble.yml
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
name: GenerateEnsemble
on:
workflow_dispatch:
workflow_run:
workflows: [GenerateBaseline]
types:
- completed
jobs:
ensemble:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'european-modelling-hubs' }}
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
# checkout repo
- uses: actions/checkout@v3
with:
path: './repo/'
# Checkout the python tools repo
# -------------------------------------------
- name: checkout python tools repo
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: 'european-modelling-hubs/hub-tools'
ref: 'main'
path: './tools/'
- uses: r-lib/actions/setup-r@v2
with:
install-r: false
use-public-rspm: true
- name: Installing dependencies
run: |
install.packages("remotes")
remotes::install_github("Infectious-Disease-Modeling-Hubs/hubData")
remotes::install_github("Infectious-Disease-Modeling-Hubs/hubEnsembles")
install.packages("dplyr")
install.packages("jsonlite")
install.packages("optparse")
install.packages("purrr")
shell: Rscript {0}
- name: Generate Ensemble
id: generate_ensemble
run: |
# call R script from tools
Rscript ./tools/R-code/generate-ensemble.R --hub_path "./repo" --agg_fun "median" --model_id "hubEnsemble" --team_id "respicast"
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
cwd: './repo'
message: "Update ensemble data"
default_author: github_actions
push: true
# Save changes to artifact for later persisting
- name: Save changes to artifact
env:
changed_files: ${{ steps.generate_ensemble.outputs.ensemble_file }}
run: |
echo "{ \"pr-changes\" : \"$changed_files\" }" > pr_changes.json
- name: Upload changes
uses: actions/upload-artifact@v2
with:
name: pr_changes
path: ./pr_changes.json