Sync Data #16
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: Sync Data | |
on: | |
workflow_dispatch: | |
inputs: | |
confirm: | |
type: boolean | |
description: 'Confirm Manual Trigger for Sync Job' | |
required: true | |
push: | |
branches: ['main'] | |
paths: ['data/*/records.json'] | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Build and Run | |
env: | |
BASE_URL: ${{ secrets.BASE_URL }} | |
WDB_USERNAME: ${{ secrets.WDB_USERNAME }} | |
WDB_PASSWORD: ${{ secrets.WDB_PASSWORD }} | |
run: | | |
echo '## Sync Summary 📋' >> $GITHUB_STEP_SUMMARY | |
trigger=$(echo ${{ github.event_name }}) | |
if [ $trigger == "workflow_dispatch" ]; then | |
echo "💡 Trigger: Manual" >> $GITHUB_STEP_SUMMARY | |
elif [ $trigger == "push" ]; then | |
echo "💡 Trigger: Record Updated" >> $GITHUB_STEP_SUMMARY | |
fi | |
cd ${GITHUB_WORKSPACE}/push | |
pip install -r requirements.txt | |
echo "### 🪵 Sync Run Logs" >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
python3 app.py | |
cat push.log | |
cat push.log >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
echo "✅ Sync Run Completed." >> $GITHUB_STEP_SUMMARY |