From 49a9ae7f4f6c596cc5db75522dcf6645b8538bf9 Mon Sep 17 00:00:00 2001 From: davi-aguiar-vieira Date: Fri, 2 Aug 2024 21:41:11 -0300 Subject: [PATCH] =?UTF-8?q?Worflow=20de=20=20automa=C3=A7=C3=A3o=20da=20co?= =?UTF-8?q?leta=20dos=20dados=20das=20empresas=20(coleta=5Fcnpjs.py)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cnpj.yml | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/cnpj.yml diff --git a/.github/workflows/cnpj.yml b/.github/workflows/cnpj.yml new file mode 100644 index 0000000..27bd7b1 --- /dev/null +++ b/.github/workflows/cnpj.yml @@ -0,0 +1,50 @@ +name: Atualizar CNPJs + +on: + workflow_run: + workflows: ["Atualizar Info Empresa"] + types: + - completed + workflow_dispatch: + +permissions: + contents: write + +jobs: + update-cnpjs: + 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 CNPJ script + run: python Dados/Coleta_dados/coleta_cnpjs.py "0" "w" "[\n" "," + + - name: Run CNPJ script + run: python Dados/Coleta_dados/coleta_cnpjs.py "1" "a" "\n" "," + + - name: Run CNPJ script + run: python Dados/Coleta_dados/coleta_cnpjs.py "2" "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