-
Notifications
You must be signed in to change notification settings - Fork 0
Add actionlint workflow and fix requirements traceability validator #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Revisión de workflows | ||
|
|
||
| Resumen automático de los triggers y jobs definidos en `.github/workflows`. | ||
|
|
||
| | Workflow | Triggers | Jobs principales | | ||
| | --- | --- | --- | | ||
| | actionlint.yml | push, pull_request, workflow_dispatch | actionlint | | ||
| | agents-ci.yml | push, pull_request, workflow_dispatch | code-quality, tests, module-tests, performance, security-tests, integration-tests, build-status | | ||
| | backend-ci.yml | push, pull_request | lint, test-mysql, test-postgresql, validate-restrictions, integration-tests, summary | | ||
| | code-quality.yml | pull_request, workflow_dispatch | smoke-checks | | ||
| | codeql.yml | push, pull_request, schedule | analyze | | ||
| | dependency-review.yml | pull_request | review | | ||
| | deploy.yml | push, workflow_dispatch | pre-deployment-checks, run-tests, build-backend, build-frontend, deploy-staging, deploy-production, post-deployment-monitoring | | ||
| | docs-validation.yml | pull_request, push | validate-structure, check-old-references, check-markdown-links, validate-auto-generated-docs, count-docs-stats, summary | | ||
| | docs.yml | push, pull_request, workflow_dispatch | build, deploy, check-links | | ||
| | emoji-validation.yml | pull_request, push | check-emojis | | ||
| | frontend-ci.yml | push, pull_request | lint, test-unit, test-integration, test-e2e, build, accessibility, security, summary | | ||
| | incident-response.yml | workflow_dispatch | create-incident-issue, gather-diagnostics, execute-incident-playbook, notify-team, summary | | ||
| | infrastructure-ci.yml | push, pull_request | validate-shell-scripts, test-validation-scripts, validate-terraform, validate-docker, validate-configurations, test-health-check, summary | | ||
| | lint.yml | pull_request, push | lint-frontmatter | | ||
| | meta-architecture-check.yml | pull_request, push, workflow_dispatch | architecture-analysis, code-quality-gate | | ||
| | migrations.yml | pull_request, push | detect-migrations, validate-migrations, check-migration-safety, generate-migration-report, summary | | ||
| | pr-review.yml | issue_comment | pr-validation | | ||
| | python_ci.yml | push, pull_request, workflow_dispatch | code-quality, tests, performance, dependency-check, build-status | | ||
| | release.yml | push, workflow_dispatch | validate-version, generate-changelog, create-release-packages, update-version-files, create-github-release, notify-stakeholders, release-summary | | ||
| | requirements_index.yml | push, pull_request, workflow_dispatch | generate-indices | | ||
| | requirements_validate_traceability.yml | pull_request, push, workflow_dispatch | validate-traceability | | ||
| | security-scan.yml | push, pull_request, schedule | bandit-scan, npm-audit, safety-check, django-security-check, trivy-scan, secrets-scan, sql-injection-check, xss-check, csrf-check, generate-security-report, summary | | ||
| | sync-docs.yml | schedule, workflow_dispatch | sync-documentation, notify-failure | | ||
| | test-pyramid.yml | push, pull_request, schedule | analyze-test-pyramid, test-execution-time, summary | | ||
| | validate-guides.yml | pull_request, push, workflow_dispatch | validate-structure, check-broken-links, generate-coverage-report, quality-checks, summary | | ||
|
|
||
| ## Hallazgos destacados | ||
|
|
||
| - **requirements_validate_traceability.yml**: el script de validación estaba mal indentado y sin parsing robusto del front matter, lo que podía provocar errores de ejecución. Se reescribió con PyYAML, normalización de listas y reporte explícito de errores para evitar falsos positivos. | ||
| - **Cobertura de calidad de YAML**: no existía un guardrail automático para los workflows. Se añadió `actionlint.yml` para validar sintaxis y convenciones de GitHub Actions en `push`, `pull_request` y `workflow_dispatch`. | ||
| - **Optimización pendiente**: `deploy.yml` puede beneficiarse de cachear dependencias Python (setup-python con `cache: 'pip'`) para acelerar las ejecuciones. `pr-review.yml` funciona solo con `issue_comment`; si se requiere validación previa al comentario, añadir `workflow_dispatch` como trigger manual daría más control. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: Lint GitHub Actions | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - develop | ||
| paths: | ||
| - '.github/workflows/**' | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - develop | ||
| paths: | ||
| - '.github/workflows/**' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| actionlint: | ||
| name: Validate workflow syntax | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Run actionlint | ||
| uses: docker://ghcr.io/rhysd/actionlint:1.7.1 | ||
| with: | ||
| args: -color |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,6 +21,9 @@ jobs: | |||||||||||||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Install validation dependencies | ||||||||||||||||||||||||||||||
| run: pip install pyyaml | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Setup Python | ||||||||||||||||||||||||||||||
| uses: actions/setup-python@v5 | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
|
Comment on lines
+24
to
29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The workflow installs PyYAML before running Useful? React with 👍 / 👎. |
||||||||||||||||||||||||||||||
|
|
@@ -32,7 +35,18 @@ jobs: | |||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||||
| import re | ||||||||||||||||||||||||||||||
| import sys | ||||||||||||||||||||||||||||||
| from collections import defaultdict | ||||||||||||||||||||||||||||||
| from typing import Iterable, List | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| import yaml | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| FRONT_MATTER_PATTERN = re.compile(r"^---\s*\n(.*?)\n---\s*", re.DOTALL) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| def ensure_list(value: Iterable | str | None) -> List[str]: | ||||||||||||||||||||||||||||||
|
Comment on lines
+38
to
+44
|
||||||||||||||||||||||||||||||
| from typing import Iterable, List | |
| import yaml | |
| FRONT_MATTER_PATTERN = re.compile(r"^---\s*\n(.*?)\n---\s*", re.DOTALL) | |
| def ensure_list(value: Iterable | str | None) -> List[str]: | |
| from typing import Iterable, List, Any | |
| import yaml | |
| FRONT_MATTER_PATTERN = re.compile(r"^---\s*\n(.*?)\n---\s*", re.DOTALL) | |
| def ensure_list(value: str | Iterable[Any] | None) -> List[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dependencies are installed before Python is set up. The 'Install validation dependencies' step should be moved after 'Setup Python' to ensure pip uses the correct Python version and environment. The current order may use the system Python instead of the configured 3.11 version.