2026-01-18 — Fix CI: Gitleaks failing on shallow checkout
Documentação KOLOS

2026-01-18 — Fix CI: Gitleaks failing on shallow checkout

Contexto

O job de segurança (gitleaks/gitleaks-action@v2) falhou com:

  • fatal: ambiguous argument '<sha>^..</sha>': unknown revision or path not in the working tree

Isso acontece quando o workflow usa checkout shallow (histórico incompleto). No evento push, o gitleaks tenta escanear um range de commits (<from>^..<to>) e precisa do commit pai (^). Com fetch-depth padrão, esse pai pode não existir no runner.

Decisão

Configurar actions/checkout@v4 no job security com fetch-depth: 0 para garantir que o range de commits esteja disponível.

Passos

  • Atualizar o workflow em .github/workflows/pipeline.yml.

Validação

  • Executar o workflow em um novo push.
  • Confirmar que o step Gitleaks (secrets scan) completa sem erro.

Impacto

  • Job security passa a baixar histórico completo no runner.
  • Elimina falhas de gitleaks causadas por range de commits inexistente em checkout shallow.