Collect Weather Data #469
This file contains hidden or 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: Collect Weather Data | |
| on: | |
| schedule: | |
| - cron: '0 */6 * * *' # Runs every 6 hours | |
| workflow_dispatch: # Allows manual triggering | |
| # Add explicit permissions | |
| permissions: | |
| contents: write | |
| jobs: | |
| collect-data: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run data collection | |
| env: | |
| OPENWEATHERMAP_API_KEY: ${{ secrets.OPENWEATHERMAP_API_KEY }} | |
| MONGODB_URI: ${{ secrets.MONGODB_URI }} | |
| run: | | |
| # Run a short data collection cycle (2 minutes) | |
| python -c "from run_demo import run_demo; run_demo(duration_minutes=2)" | |
| - name: Log data collection completion | |
| run: echo "Data collection completed at $(date)" |