Worflow de automação da coleta dos dados das empresas (coleta_cnpjs.py) #5
Workflow file for this run
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: Atualizar contratos | |
on: | |
schedule: | |
- cron: '0 2 * * 6' | |
push: | |
branches: | |
- mateus | |
workflow_dispatch: | |
jobs: | |
update-data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Run update script 2021-2022 | |
run: python Dados/Coleta_dados/coleta_api.py "20210102" "20220101" "w" "[\n" "," | |
- name: Run update script 2022-2023 | |
run: python Dados/Coleta_dados/coleta_api.py "20220102" "20230101" "a" "\n" "," | |
- name: Run update script 2023-2024 | |
run: python Dados/Coleta_dados/coleta_api.py "20230102" "20240101" "a" "\n" "," | |
- name: Run update script 2024-2025 | |
run: python Dados/Coleta_dados/coleta_api.py "20240102" "20250101" "a" "\n" "," | |
- name: Run update script 2025-2026 | |
run: python Dados/Coleta_dados/coleta_api.py "20250102" "20260101" "a" "\n" "\n]" | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email 'noreply.github.com' | |
git pull origin mateus | |
git add . | |
git commit -m "Atualização automática: $(date +'%Y-%m-%d %H:%M:%S')" || echo "Nada para commitar" | |
git push origin mateus | |