Update SDK Status #1
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: 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 |