github-actions

Configura GitHub Actions con detección proactiva de repos sin CI.


Triggers

Frases que activan el skill
“agregar CI”
“setup GitHub Actions”
“crear workflow”
“deploy workflow”
“automatizar tests”
“CI/CD pipeline”
“actualizar actions” / “update actions” / “bump actions”
“dependabot” / “renovate”

Detección proactiva

Al iniciar trabajo en un proyecto, el skill verifica si existe .github/workflows/:

ls -la .github/workflows/ 2>/dev/null || echo "NO_WORKFLOWS"

Si no hay workflows → pregunta si querés agregar CI básico.


Workflow del skill

1. Actualización de conocimiento

Antes de generar, verificar versiones actuales:

Action Versión actual
actions/checkout v6
actions/setup-node v6
actions/setup-python v6
actions/setup-go v6
actions/cache v5
actions/upload-artifact v7
actions/download-artifact v8

Heads up — Node 20 runtime EOL (junio 2026): las versiones viejas de las actions oficiales (@v4/@v5) corren sobre Node 20 y van a empezar a fallar. Las versiones de la tabla ya migraron a Node 24.

2. Detección de stack

# Tipo de proyecto
ls package.json && echo "NODE"
ls pyproject.toml && echo "PYTHON"
ls go.mod && echo "GO"

# Package manager (Node.js)
ls pnpm-lock.yaml && echo "PNPM"
ls bun.lockb && echo "BUN"
ls package-lock.json && echo "NPM"

3. Análisis de scripts (Node.js)

Lee package.json y detecta scripts disponibles:

  • lint → Incluir linting
  • typecheck → Incluir type checking
  • test → Incluir testing
  • build → Incluir build
  • test:coverage → Incluir coverage upload

4. Selección de workflows

Node.js:

  • CI Básico (lint, typecheck, test, build)
  • Deploy a GitHub Pages
  • Release con Tags (v*)
  • Security Scans
  • Coverage Upload (Codecov)

Python:

  • CI Básico (ruff, pyright/mypy, pytest)
  • Coverage Upload

Go:

  • CI Básico (go vet, golangci-lint, go test)
  • Release binaries

Anti-patterns detectados

Anti-Pattern Fix
Actions en @v4 o anteriores Actualizar a versión actual (ver tabla arriba)
setup-node sin cache Agregar cache: 'npm'
npm install Usar npm ci
Sin concurrency: Agregar control
Matrix con una versión Remover matrix innecesario
trufflehog@main Pinear a tag versionado

Best practices aplicadas

  1. Últimas versiones de actions (verificadas 2026-04)
  2. npm ci para builds reproducibles
  3. Caching en setup-node/python/go
  4. Concurrency control para cancelar runs outdated
  5. fail-fast: true para cancelar jobs paralelos
  6. Permissions explícitos cuando se necesitan
  7. Node 22.x (LTS actual)
  8. Tags pineados en actions third-party (no @main)

Concurrency control

Siempre incluido:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

Cancela runs de PR desactualizados pero nunca cancela main.


Package manager detection

Lockfile Package Manager Install Command
pnpm-lock.yaml pnpm pnpm install --frozen-lockfile
bun.lockb bun bun install --frozen-lockfile
package-lock.json npm npm ci

Output

Workflows Created/Updated
=========================

✓ .github/workflows/ci.yml
  - Triggers: push (main), pull_request
  - Jobs: lint, typecheck, test, build
  - Node: 22.x with npm

Next Steps:
1. Review generated workflows
2. git add .github/workflows/
3. git commit -m "ci: add GitHub Actions workflow"
4. Push to trigger first run

Validación

Si actionlint está disponible:

actionlint .github/workflows/*.yml

Herramientas disponibles

  • Bash - Ejecutar comandos, detectar stack
  • Read - Leer package.json
  • Write - Crear workflows
  • Edit - Modificar workflows existentes
  • Glob - Buscar archivos
  • Grep - Buscar patrones
  • WebSearch - Verificar versiones actuales
  • Context7 - Documentación actualizada