CEPH_2024-05-12 #62
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: After Validate Submission Workflow | |
on: | |
#workflow_run: | |
# workflows: ["Hub Submission Validation (R)"] # The name of the workflow we want to trigger from | |
# types: | |
# - completed | |
pull_request_target: | |
types: | |
- closed | |
jobs: | |
copy-files-to-rsv-data-repo: | |
runs-on: ubuntu-latest | |
# if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
if: github.event.pull_request.merged == true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
install-r: false | |
use-public-rspm: true | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libcurl4-openssl-dev | |
- name: Cache R packages | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-r-${{ hashFiles('DESCRIPTION') }} | |
restore-keys: ${{ runner.os }}-r- | |
- name: Install gh package | |
run: Rscript -e 'install.packages("gh")' | |
- name: Install here package | |
run: Rscript -e 'install.packages("here")' | |
- name: Install readr package | |
run: Rscript -e 'install.packages("readr")' | |
- name: Install lubridate package | |
run: Rscript -e 'install.packages("lubridate")' | |
- name: Install ggridges package | |
run: Rscript -e 'install.packages("ggridges")' | |
- name: Install forcats package | |
run: Rscript -e 'install.packages("forcats")' | |
- name: Install arrow package | |
run: Rscript -e 'install.packages("arrow")' | |
- name: Install dplyr package | |
run: Rscript -e 'install.packages("dplyr")' | |
- name: Install jsonlite package | |
run: Rscript -e 'install.packages("jsonlite")' | |
- name: Install purrr package | |
run: Rscript -e 'install.packages("purrr")' | |
- name: Install hubViz | |
run: | | |
Rscript -e 'install.packages("remotes")' | |
Rscript -e 'remotes::install_github("Infectious-Disease-Modeling-Hubs/hubVis")' | |
- name: Install hubUtils | |
run: | | |
Rscript -e 'remotes::install_github("Infectious-Disease-Modeling-Hubs/hubUtils")' | |
- name: Install hubEnsembles | |
run: | | |
Rscript -e 'remotes::install_github("Infectious-Disease-Modeling-Hubs/hubEnsembles")' | |
- name: Install hubData | |
run: | | |
Rscript -e 'remotes::install_github("Infectious-Disease-Modeling-Hubs/hubData")' | |
- name: Run R script | |
run: | | |
cd ./scripts | |
Rscript ensemble.R | |
- name: Commit and push new files to root repository | |
run: | | |
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 model-output/hub-ensemble/* | |
git commit -m "Upload new files to root repo" | |
git push | |
echo "Data for hub-ensemble uploaded to root repo"; | |
else | |
echo "no upload for root repo"; | |
fi | |
shell: bash | |
- name: Checkout and push to another repository | |
uses: actions/checkout@v2 | |
with: | |
#repository: kjsato/rsv-forecast-hub_data | |
repository: HopkinsIDD/rsv-forecast-hub_data | |
token: ${{ secrets.KJ3_PATC }} | |
path: ./rsv-forecast-hub_data | |
fetch-depth: 2 | |
ref: main | |
- name: Copy new files | |
run: | | |
for FILE in model-output/**/* model-metadata/*; do | |
if [ -f "$FILE" ]; then | |
mkdir -p ./rsv-forecast-hub_data/$(dirname $FILE) | |
cp $FILE ./rsv-forecast-hub_data/$FILE | |
fi | |
done | |
- name: Commit and push new files | |
run: | | |
cd ./rsv-forecast-hub_data | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git pull origin main | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git commit -m "Upload new files to RSV data repo" | |
git push | |
echo "RSV data uploaded"; | |
else | |
echo "no upload"; | |
fi | |
shell: bash |