-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create workflow_submit_model_forecasts.yml
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Submit_RespiCast_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: | ||
|
||
# Checkout your forked repository - main branch - | ||
# where this action is currently hosted | ||
# --------------------------------------------------- | ||
- name: checkout forked repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Checkout the model data repository - main branch - | ||
# This is the repository where previous wf saved the model output data | ||
# In this example data repo is https://github.com/your_organization/data-repo | ||
# ----------------------------------------------------------------------------- | ||
- name: checkout data repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: 'main' # the git branch to work on | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: 'EU-ECDC/ECDC-Mathematical-Models' | ||
path: './data-repo/' # Relative path under $GITHUB_WORKSPACE to place the repository | ||
|
||
|
||
|
||
# Set the default remote repository to use when querying the GitHub API for the locally cloned repository. | ||
- run: gh repo set-default european-modelling-hubs/flu-forecast-hub | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
# Sync forked repo main branch, pull and then switch to a new brench | ||
- run: | | ||
git config --global user.email "YourGitHubUserEmail" | ||
git config --global user.name "YourGitHubUserName" | ||
gh repo sync your_organization/flu-forecast-hub -b main | ||
git pull | ||
git checkout -b my-branch | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# make a copy of the needed files from source repo to local fork | ||
- name: Copy model-output file | ||
run: cp ./data-repo/model-output_filepath local_fliepath | ||
|
||
# commit change to a new brach! This step is needed in order | ||
# to succesfully open the subsequent pull request | ||
- run: | | ||
git add local_fliepath | ||
git commit -m "Git Commit comment" | ||
git push -u origin my-branch | ||
# Finally, open the pull request from local my-branch to the main branch | ||
# secrets.MY_PAT_SECRET is a repository secret you have to create in your forked repository | ||
# containing a valid PERSONAL ACCESS TOKEN for YourGitHubUserName. | ||
# Without this secret the pr create fails with "Resource not accessible by integration" error | ||
- name: Open the pull requests | ||
run: gh pr create --head YourGitHubUserName:my-branch --base main --title 'PR Title' --body 'PR Body' | ||
env: | ||
GH_TOKEN: ${{ secrets.MY_PAT_SECRET }} |