copy data for maintenance #1
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: copy data for maintenance | |
on: | |
workflow_dispatch: | |
jobs: | |
copy-files-to-rsv-data-repo: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- 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" | |
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 |