Submit_RespiCast-SyndromicIndicators_Forecasts #11
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: Submit_RespiCast-SyndromicIndicators_Forecasts | |
# Firts step is to define di events that can trigger this workflow | |
on: | |
# Run upon previous GenerateModelOutput completion | |
workflow_run: | |
workflows: [Generate_RespiCast_Forecasts] | |
types: | |
- completed | |
# Or you can manually trigger the workflow | |
workflow_dispatch: | |
jobs: | |
create_PR_job: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the source repository (ECDC-Mathematical-Models) | |
- name: Checkout source repository | |
uses: actions/checkout@v3 | |
with: | |
repository: 'EU-ECDC/ECDC-Mathematical-Models' | |
ref: 'main' | |
path: './source-repo' | |
#token: ${{ secrets.MY_PAT_SECRET_RespiCast }} | |
# Step 2: Checkout the destination repository (RespiCast-SyndromicIndicators) | |
- name: Checkout destination repository | |
uses: actions/checkout@v3 | |
with: | |
repository: 'european-modelling-hubs/RespiCast-SyndromicIndicators' | |
ref: 'main' | |
path: './destination-repo' | |
#token: ${{ secrets.GITHUB_TOKEN }} | |
# Step 3: Sync destination repo and create a new branch | |
- name: Create a new branch | |
run: | | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
cd ./destination-repo | |
git checkout -b add-results-RespiCast-SyndromicIndicators | |
#env: | |
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Step 4: Copy the two model-output files to the destination repository | |
- name: Copy model-output files | |
run: | | |
cp ./source-repo/Forecasting-hubs_models/model_output/Syndromic_indicators/2024-11-27-ECDC-soca_simplex.csv \ | |
./destination-repo/model-output/ECDC-soca_simplex/ | |
cp ./source-repo/Forecasting-hubs_models/model_output/Syndromic_indicators/2024-11-27-ECDC-SARIMA.csv \ | |
./destination-repo/model-output/ECDC-SARIMA/ | |
shell: bash | |
# Step 5: Commit the files to the new branch | |
- name: Commit changes | |
run: | | |
cd ./destination-repo | |
git add ./model-output/ECDC-soca_simplex/2024-11-27-ECDC-soca_simplex.csv \ | |
./model-output/ECDC-SARIMA/2024-11-27-ECDC-SARIMA.csv | |
git commit -m "Submitting forecasts of Syndromic_indicators - soca_simplex and SARIMA models" | |
git push -u origin add-results-RespiCast-SyndromicIndicators | |
git push -u https://x-access-token:${{ secrets.FORECASTHUB_TOKEN }}@github.com/european-modelling-hubs/RespiCast-SyndromicIndicators.git add-results-files | |
#env: | |
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Step 6: Open a pull request | |
- name: Create a pull request | |
run: | | |
cd ./destination-repo | |
gh pr create --head github-actions[bot]:add-results-files \ | |
--base main \ | |
--title "Submitting ECDC forecasts" \ | |
--body "This PR adds the ECDC forecasts to RespiCast repo." | |
env: | |
GH_TOKEN: ${{ secrets.Secret_PUSH_ACCESS_RespiCast }} | |