Actualización Divisas #1222
This file contains hidden or 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: Actualización Divisas | |
| on: | |
| schedule: | |
| # Se ejecuta cada 4 horas | |
| - cron: "0 */1 * * *" | |
| workflow_dispatch: # Permite ejecución manual desde GitHub | |
| jobs: | |
| actualizar: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repositorio | |
| uses: actions/checkout@v3 | |
| - name: Configurar Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Instalar dependencias | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| playwright install chromium | |
| - name: Ejecutar Extracción y Actualización | |
| run: | | |
| python main.py | |
| - name: Commit and Push changes | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git config --global pull.rebase true | |
| git add Almacenamiento/divisas.db datos.json | |
| git commit -m "Automated update: Divisas data e index.html [skip ci]" || echo "No changes to commit" | |
| # Escondemos temporalmente basura (ej: __pycache__, logs del db) para que el rebase no choque | |
| git stash --include-untracked | |
| git pull origin main | |
| # Restauramos la basura local en caso de necesitarse luego, y descartamos | |
| git stash pop || true | |
| git push |