docs(trazabilidad): remover referencias a canvas y GEM #29
Workflow file for this run
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: Documentation Sync (Weekly) | ||
| on: | ||
| branches: [ main ] | ||
| # Ejecución programada: Lunes 9:00 AM UTC | ||
| schedule: | ||
| - cron: '0 9 * * 1' | ||
| # Permitir ejecución manual desde GitHub UI | ||
| workflow_dispatch: | ||
| inputs: | ||
| domains: | ||
| description: 'Dominios a sincronizar (separados por coma)' | ||
| required: false | ||
| default: 'api,ui,infrastructure' | ||
| type: string | ||
| dry_run: | ||
| description: 'Modo dry-run (no escribe archivos)' | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
| jobs: | ||
| sync-documentation: | ||
| name: Sync Code → Documentation | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
| - name: Configure git | ||
| run: | | ||
| git config --global user.name "Documentation Sync Bot" | ||
| git config --global user.email "docs-sync-bot@iact-project.local" | ||
| - name: Run documentation sync agent | ||
| id: sync | ||
| run: | | ||
| echo "::group::Running Documentation Sync Agent" | ||
| DOMAINS="${{ github.event.inputs.domains || 'api,ui,infrastructure' }}" | ||
| DRY_RUN="${{ github.event.inputs.dry_run || 'false' }}" | ||
| echo "Domains: $DOMAINS" | ||
| echo "Dry-run: $DRY_RUN" | ||
| if [ "$DRY_RUN" == "true" ]; then | ||
| python scripts/sync_documentation.py --dry-run --domains "$DOMAINS" | tee sync_output.log | ||
| else | ||
| python scripts/sync_documentation.py --domains "$DOMAINS" | tee sync_output.log | ||
| fi | ||
| EXIT_CODE=$? | ||
| echo "::endgroup::" | ||
| # Capturar estadísticas del output | ||
| CREATED=$(grep "Documentación creada:" sync_output.log | awk '{print $3}' || echo 0) | ||
| UPDATED=$(grep "Documentación actualizada:" sync_output.log | awk '{print $3}' || echo 0) | ||
| echo "docs_created=$CREATED" >> $GITHUB_OUTPUT | ||
| echo "docs_updated=$UPDATED" >> $GITHUB_OUTPUT | ||
| exit $EXIT_CODE | ||
| - name: Check for documentation changes | ||
| id: check_changes | ||
| run: | | ||
| if [ "${{ github.event.inputs.dry_run }}" == "true" ]; then | ||
| echo "Dry-run mode: skipping change detection" | ||
| echo "has_changes=false" >> $GITHUB_OUTPUT | ||
| exit 0 | ||
| fi | ||
| git add docs/ | ||
| if git diff --cached --quiet; then | ||
| echo "No documentation changes detected" | ||
| echo "has_changes=false" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "Documentation changes detected" | ||
| echo "has_changes=true" >> $GITHUB_OUTPUT | ||
| echo "::group::Changed files" | ||
| git diff --cached --name-only | ||
| echo "::endgroup::" | ||
| fi | ||
| - name: Get latest sync report | ||
| if: steps.check_changes.outputs.has_changes == 'true' | ||
| id: get_report | ||
| run: | | ||
| LATEST_REPORT=$(find docs/anexos/analisis_nov_2025/ -name "SYNC_REPORT_*.md" -type f -printf '%T@ %p\n' | sort -nr | head -1 | cut -d' ' -f2-) | ||
| if [ -n "$LATEST_REPORT" ]; then | ||
| echo "report_path=$LATEST_REPORT" >> $GITHUB_OUTPUT | ||
| echo "Found report: $LATEST_REPORT" | ||
| else | ||
| echo "No sync report found" | ||
| echo "report_path=" >> $GITHUB_OUTPUT | ||
| fi | ||
| - name: Create Pull Request | ||
| if: steps.check_changes.outputs.has_changes == 'true' | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| commit-message: | | ||
| docs: auto-sync documentation from code changes | ||
| Sincronización automática ejecutada por DocumentationSyncAgent. | ||
| Estadísticas: | ||
| - Documentos creados: ${{ steps.sync.outputs.docs_created }} | ||
| - Documentos actualizados: ${{ steps.sync.outputs.docs_updated }} | ||
| Reporte: ${{ steps.get_report.outputs.report_path }} | ||
| Generado automáticamente por: .github/workflows/sync-docs.yml | ||
| branch: auto-sync-docs-${{ github.run_number }} | ||
| delete-branch: true | ||
| title: 'docs: weekly auto-sync from code changes' | ||
| body: | | ||
| ## 🤖 Sincronización Automática de Documentación | ||
| Esta PR fue generada automáticamente por el **DocumentationSyncAgent** durante la sincronización semanal programada. | ||
| ### 📊 Estadísticas | ||
| - **Documentos creados**: ${{ steps.sync.outputs.docs_created }} | ||
| - **Documentos actualizados**: ${{ steps.sync.outputs.docs_updated }} | ||
| - **Fecha de ejecución**: ${{ github.event.repository.updated_at }} | ||
| ### 📝 Cambios Detectados | ||
| El agente inspeccionó el código en: | ||
| - `api/callcentersite/callcentersite/apps/` (Django apps) | ||
| - `ui/src/modules/` (React modules) | ||
| - `infrastructure/` (Terraform configs) | ||
| Y generó/actualizó la documentación correspondiente en: | ||
| - `docs/backend/arquitectura/` | ||
| - `docs/frontend/arquitectura/` | ||
| - `docs/infrastructure/` | ||
| ### 🔍 Revisión Requerida | ||
| Por favor revisa: | ||
| 1. [PASS] Que la información auto-generada es correcta | ||
| 2. [PASS] Que los modelos detectados son actuales | ||
| 3. [PASS] Que no hay información sensible expuesta | ||
| 4. [PASS] Que las secciones "Documentar..." fueron completadas si aplica | ||
| ### 📄 Reporte Completo | ||
| Ver reporte detallado en: `${{ steps.get_report.outputs.report_path }}` | ||
| ### 🚀 Próximos Pasos | ||
| Si los cambios son correctos: | ||
| 1. Revisar archivos modificados | ||
| 2. Completar secciones que quedaron como "Documentar..." | ||
| 3. Aprobar y merge esta PR | ||
| --- | ||
| *Generado por: [Documentation Sync Workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})* | ||
| *Próxima ejecución programada: Lunes 9:00 AM UTC* | ||
| labels: | | ||
| documentation | ||
| automated | ||
| sync-agent | ||
| assignees: arquitecto-senior | ||
| draft: false | ||
| - name: Comment on PR with details | ||
| if: steps.check_changes.outputs.has_changes == 'true' | ||
| run: | | ||
| echo "::notice::Pull Request created successfully" | ||
| echo "Documentation sync completed with changes" | ||
| - name: No changes detected | ||
| if: steps.check_changes.outputs.has_changes == 'false' | ||
| run: | | ||
| echo "::notice::No documentation changes detected" | ||
| echo "Code and documentation are already in sync" | ||
| notify-failure: | ||
| name: Notify on Failure | ||
| runs-on: ubuntu-latest | ||
| needs: sync-documentation | ||
| if: failure() | ||
| steps: | ||
| - name: Create issue on failure | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const issue = await github.rest.issues.create({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| title: '🚨 Documentation Sync Failed', | ||
| body: `## Fallo en Sincronización Automática de Documentación | ||
| La ejecución programada del DocumentationSyncAgent falló. | ||
| ### Detalles | ||
| - **Workflow Run**: [#${context.runNumber}](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) | ||
| - **Fecha**: ${new Date().toISOString()} | ||
| - **Trigger**: ${context.eventName} | ||
| ### Acción Requerida | ||
| Por favor revisa los logs del workflow y ejecuta manualmente si es necesario: | ||
| \`\`\`bash | ||
| python scripts/sync_documentation.py --dry-run --domains api,ui,infrastructure | ||
| \`\`\` | ||
| ### Posibles Causas | ||
| - Cambios en estructura de código que el agente no pudo parsear | ||
| - Errores en scripts de sincronización | ||
| - Problemas de permisos o dependencias | ||
| --- | ||
| *Issue generado automáticamente por: .github/workflows/sync-docs.yml*`, | ||
| labels: ['bug', 'documentation', 'automated', 'sync-agent'] | ||
| }); | ||
| console.log('Issue created:', issue.data.html_url); | ||