Skip to content

Commit 1a0a7ed

Browse files
Update estrutura.yml
1 parent ea3a3fb commit 1a0a7ed

1 file changed

Lines changed: 18 additions & 19 deletions

File tree

.github/workflows/estrutura.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
name: Estrutura ANAC
22
on:
3-
workflow_dispatch: {}
4-
push:
5-
paths:
6-
- .github/workflows/estrutura.yml
7-
schedule:
8-
- cron: "0 3-6 * * 0-6"
3+
workflow_dispatch:
94

105
jobs:
11-
schedule:
6+
download-file:
127
runs-on: ubuntu-latest
138
steps:
14-
- name: Setup deno
15-
uses: denoland/setup-deno@main
16-
with:
17-
deno-version: v1.x
18-
199
- name: Check out repo
2010
uses: actions/checkout@v4
2111

22-
- name: Fetch data
23-
uses: githubocto/flat@v3
12+
- name: Baixar arquivo JSON da API
13+
uses: githubocto/flat@v4
2414
with:
25-
http_url: "https://estruturaorganizacional.dados.gov.br/doc/estrutura-organizacional/completa.json?codigoPoder=1&codigoEsfera=1&codigoUnidade=86144&retornarOrgaoEntidadeVinculados=SIM"
26-
downloaded_filename: "anac/estrutura.json"
27-
flatten: "false"
15+
# A URL da API
16+
http_url: 'https://estruturaorganizacional.dados.gov.br/doc/estrutura-organizacional/completa.json?codigoPoder=1&codigoEsfera=1&codigoUnidade=86144&retornarOrgaoEntidadeVinculados=SIM'
17+
downloaded_filename: 'anac/estrutura.json'
18+
# NOVO E IMPORTANTE: Garante que o JSON seja salvo em seu formato original, sem processamento.
19+
flatten: 'false'
2820

29-
- name: Pós-processamento JSON (Deno)
30-
run: deno run --allow-read --allow-write ./scripts/estrutura.ts anac/estrutura.json
21+
- name: Commit e push de arquivos, se houver mudanças
22+
run: |
23+
git config user.name github-actions
24+
git config user.email [email protected]
25+
git add :/
26+
COMMIT_MESSAGE="$(date +"%Y-%m-%d %H:%M")"
27+
git commit -m "$COMMIT_MESSAGE" || exit 0
28+
git pull --rebase
29+
git push

0 commit comments

Comments
 (0)