Update spider status on production #285
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: Update spider status on production | |
on: | |
workflow_dispatch: | |
inputs: | |
spider_name: | |
description: 'Spider name' | |
required: true | |
status: | |
type: choice | |
description: 'New Spider status in production' | |
options: | |
- enabled | |
- disabled | |
required: true | |
jobs: | |
update-status: | |
runs-on: ubuntu-latest | |
env: | |
QUERIDODIARIO_DATABASE_URL: ${{ secrets.QUERIDODIARIO_DATABASE_URL }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Prepare environment | |
run: | | |
python -m pip install --upgrade pip | |
pip install click python-decouple scrapinghub SQLAlchemy psycopg2 | |
- name: Enable spider in production | |
if: ${{ github.event.inputs.status == 'enabled' }} | |
run: | | |
cd data_collection/ | |
python scheduler.py enable-spider --spider_name=${{ github.event.inputs.spider_name }} | |
- name: Disable spider in production | |
if: ${{ github.event.inputs.status == 'disabled' }} | |
run: | | |
cd data_collection/ | |
python scheduler.py disable-spider --spider_name=${{ github.event.inputs.spider_name }} |