.github/workflows/daily_parser.yml #33
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: Run Parser Daily | |
# Controls when the action will run | |
on: | |
schedule: | |
# Runs at 00:00 UTC every day | |
- cron: '0 0 * * *' | |
# Allows the workflow to be run manually (optional) | |
workflow_dispatch: | |
# Job to run the script | |
jobs: | |
run-parser: | |
runs-on: ubuntu-latest | |
services: | |
mongodb: | |
image: mongo:5.0 | |
ports: | |
- 27017:27017 | |
# options: >- | |
# --health-cmd "mongo --eval 'db.runCommand({ ping: 1 })'" | |
# --health-interval 10s | |
# --health-timeout 5s | |
# --health-retries 3 | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Python environment | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: Clear pip cache | |
run: pip cache purge | |
# Step 3: Install dependencies | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install -r requirements.txt | |
- name: Install requests directly | |
run: pip install requests | |
- name: List installed packages | |
run: pip list # Verify installed packages | |
# Step 4: Run the parser script | |
- name: Run parser.py | |
env: | |
MONGO_URI: "mongodb+srv://wangaus1997:[email protected]/?retryWrites=true&w=majority&appName=Cluster0" | |
run: | |
python app/parser.py |