-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (92 loc) · 3.3 KB
/
update-status.yml
File metadata and controls
114 lines (92 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Update SDK Status
on:
workflow_run:
workflows: ["Release"]
types: [completed]
branches: [main]
workflow_dispatch:
schedule:
- cron: '0 7 * * *' # Daily at 7 AM UTC (after validation)
permissions:
contents: write
jobs:
update-status:
name: Update SDK Status
runs-on: ubuntu-latest
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Get latest version
id: version
run: |
VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])" 2>/dev/null || grep -m1 'version' setup.py | cut -d'"' -f2 || echo "unknown")
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Get validation status
id: validation
run: |
VALIDATION_STATUS=$(gh run list --workflow=sdk-validation.yml --limit 1 --json conclusion --jq '.[0].conclusion // "unknown"')
if [ "$VALIDATION_STATUS" = "success" ]; then
echo "STATUS=FUNCIONAL" >> $GITHUB_OUTPUT
echo "EMOJI=🟢" >> $GITHUB_OUTPUT
else
echo "STATUS=VERIFICAR" >> $GITHUB_OUTPUT
echo "EMOJI=🟡" >> $GITHUB_OUTPUT
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update SDK-STATUS.md
run: |
DATE=$(date -u +%Y-%m-%d)
VERSION="${{ steps.version.outputs.VERSION }}"
STATUS="${{ steps.validation.outputs.STATUS }}"
EMOJI="${{ steps.validation.outputs.EMOJI }}"
cat > SDK-STATUS.md << EOF
# Python SDK Status
**Última atualização:** ${DATE}
**Versão:** ${VERSION}
**Status:** ${EMOJI} ${STATUS}
---
## Informações
| Item | Valor |
|------|-------|
| **Versão** | ${VERSION} |
| **Registry** | PyPI (\`pip install iptuapi\`) |
| **Status** | ${EMOJI} ${STATUS} |
| **Mínimo** | Python 3.8+ |
## Instalação
\`\`\`bash
pip install iptuapi
\`\`\`
## Exemplo Rápido
\`\`\`python
from iptuapi import IPTUClient
client = IPTUClient("sua_api_key")
cidades = client.iptu_tools_cidades()
print(f"{cidades['total']} cidades disponíveis")
\`\`\`
## Validação Automática
Este SDK é validado automaticamente:
- ✅ Instalação limpa via pip
- ✅ Import do pacote
- ✅ Teste contra API real (\`iptu_tools_cidades\`)
- ✅ Teste autenticado (\`consulta_endereco\`)
---
*Atualizado automaticamente pelo CI/CD*
EOF
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add SDK-STATUS.md
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "chore: update SDK status [skip ci]"
git push
fi