GenerateEnsemble #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "GenerateEnsemble" | |
on: | |
workflow_dispatch: | |
# scheduled run every Wednesday at 03.00 a.m. (Wednesday 02.00 a.m.UTC) | |
# TODO for the time being upload is Thursday at 03.00 a.m. (Thursday 02.00 a.m. UTC) | |
schedule: | |
- cron: '00 02 * * 3' | |
jobs: | |
ensemble_job: | |
if: github.repository_owner == 'Predizioni-Epidemiologiche-Italia' | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the python tools repo | |
# ------------------------------------------- | |
- name: checkout python tools repo | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
repository: 'Predizioni-Epidemiologiche-Italia/hub-tools' | |
ref: 'main' | |
path: './tools/' | |
# Checkout the data repository | |
# ------------------------------------------- | |
- name: checkout data repo | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
repository: 'Predizioni-Epidemiologiche-Italia/Influcast' | |
ref: 'main' | |
path: './repo/' | |
# Run Pyton code | |
# ------------------------- | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- run: pip install pandas isoweek==1.3.3 | |
- name: Pyhton | |
id: compute_ensemble | |
run: | | |
python ./tools/code/compute_ensemble.py | |
- name: Commit data repo changes | |
uses: EndBug/add-and-commit@v7 | |
with: | |
cwd: './repo' | |
message: "Update data storage" | |
default_author: github_actions | |
push: true | |
# Save changes to artifact for later persisting | |
- name: Save changes to artifact | |
env: | |
changed_files: ${{ steps.compute_ensemble.outputs.ensemble_file }} | |
run: | | |
echo "{ \"pr-changes\" : \"previsioni/Influcast-Ensemble/$changed_files\" }" > pr_changes.json | |
- name: Upload changes | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr_changes | |
path: ./pr_changes.json | |