Skip to content

Commit

Permalink
modified validate-submission.yaml and appended after-validate-submiss…
Browse files Browse the repository at this point in the history
…ion.yaml to invoke a workflow after merged PR data because a PR from forked repo cannot permit using secrets
  • Loading branch information
kjsato committed Mar 5, 2024
1 parent 992835b commit 43bf033
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 34 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/after-validate-submission.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: After Validate Submission Workflow

on:
workflow_run:
workflows: ["Validate Submission"] # The name of the workflow we want to trigger from
types:
- completed

jobs:
job1:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Checkout and push to another repository
uses: actions/checkout@v2
with:
repository: HopkinsIDD/rsv-forecast-hub_data
token: ${{ secrets.KJ3_PATC }}
path: ./rsv-forecast-hub_data
fetch-depth: 2

- name: Copy new files
run: |
FILES=$(git diff --name-only HEAD^ HEAD)
for FILE in $FILES
do
if [[ $FILE == model-output/* ]] || [[ $FILE == model-metadata/* ]]; 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"
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
34 changes: 0 additions & 34 deletions .github/workflows/validate-submission.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,38 +47,4 @@ jobs:
hubValidations::check_for_errors(v)
shell: Rscript {0}

- name: Checkout and push to another repository
if: success()
uses: actions/checkout@v2
with:
repository: HopkinsIDD/rsv-forecast-hub_data
token: ${{ secrets.KJ3_PATC }}
path: ./rsv-forecast-hub_data
fetch-depth: 2

- name: Copy new files
run: |
FILES=$(git diff --name-only HEAD^ HEAD)
for FILE in $FILES
do
if [[ $FILE == model-output/* ]] || [[ $FILE == model-metadata/* ]]; 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"
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

0 comments on commit 43bf033

Please sign in to comment.