name: gitleaks on: [push, pull_request] jobs: gitleaks: runs-on: ubuntu-latest steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 with: { fetch-depth: 0 } - name: Instalar gitleaks run: | set -euo pipefail # El CDN de los releases de GitHub devuelve 504 a ratos y marcaba en # rojo PRs sin secretos. Primero tarball con reintentos; si no baja, # se compila desde el modulo Go (proxy.golang.org, otro CDN). url=https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz if curl -fsSL --retry 3 --retry-delay 3 --retry-all-errors -o /tmp/gitleaks.tar.gz "$url"; then echo "551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb /tmp/gitleaks.tar.gz" | sha256sum -c - sudo tar xzf /tmp/gitleaks.tar.gz -C /usr/local/bin gitleaks else echo "tarball no disponible; compilando gitleaks v8.30.1 desde el modulo" # Fuera del modulo del repo: go install con @version no admite el # contexto del go.mod del proyecto. # v8.30.1 declara el modulo con el nombre antiguo del repo. (cd /tmp && go install github.com/zricethezav/gitleaks/v8@v8.30.1) sudo install -m 755 "$(go env GOPATH)/bin/gitleaks" /usr/local/bin/gitleaks fi gitleaks version - name: Escanear secretos en todo el historial run: gitleaks git . --redact --no-banner