Scraping Workflow #225
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: Scraping Workflow | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Runs at 00:00 (UTC) every day | |
workflow_dispatch: | |
jobs: | |
run-scraping-script: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Read .python-version | |
run: echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.lock | |
- name: Run scrapy.py | |
run: python scripts/scraping.py | |
- name: Commit and push if there are changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add data/ | |
git commit -m "Automatically update data" -a || echo "No changes to commit" | |
git push |