Skip to content

Update spider status on production #78

Update spider status on production

Update spider status on production #78

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 }}