pescap / WebScrapingMDS

Proyectos del curso de Web Scraping del MDS UAI 2022
GNU General Public License v3.0
12 stars 42 forks source link

Aplicando Actions en el proyecto 90 #286

Open molivadatascience opened 1 year ago

molivadatascience commented 1 year ago

Tratar de tener una opción diaria de actualización del proyecto 90.

molivadatascience commented 1 year ago

Propuesta de código a utilizar

name: producto90
on:
  schedule:
  - cron: "0 1 * * *"
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  producto90:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v2
      - name: Setup Python
        uses: actions/setup-python@v1
        with:
          python-version: "3.8"

      - name: Install Python dependencies
        run: |
            cd producto90
            pip install -r requirements.txt
      - name: Run scraper
        run: |
            cd producto90
            python scraper.py

      - name: Commit data files
        run: |
          pwd
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git status
          git add -A
          git commit -a -m "Added new date for producto90" || echo "Nothing to commit"
      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: main
          force: true