Fetch MongoDB Data #31
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: Fetch MongoDB Data | |
on: | |
schedule: | |
- cron: '0 0 * * 0' # Runs weekly on Sunday at midnight | |
workflow_dispatch: | |
jobs: | |
fetch_data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout master branch | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install MongoDB client | |
run: | | |
python -m pip install --upgrade pip | |
pip install pymongo | |
- name: Fetch Data from MongoDB | |
env: | |
MONGODB_URI: ${{ secrets.MONGODB_URI }} | |
run: | | |
python fetch_data.py | |
- name: Commit and Push changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add -A | |
git commit -m "Update data files" || true | |
git push |