Skip to content

fix: configura autenticacao git no codenarc action para evitar erro 128#69

Merged
felipeeffting merged 3 commits intomainfrom
corrige-erro-128-codenarc-action
Feb 4, 2026
Merged

fix: configura autenticacao git no codenarc action para evitar erro 128#69
felipeeffting merged 3 commits intomainfrom
corrige-erro-128-codenarc-action

Conversation

@anaalves-asaas
Copy link
Contributor

Impacto

Configurada autenticação git no CodeNarc para resolver erro 128 que ocorria ao tentar fazer git fetch sem credenciais. O github_token já era passado para o container, mas não estava configurado para operações git.

Mudança:

  • Adicionada configuração de autenticação git usando o token do GitHub já disponível
  • Git agora usa automaticamente o token para operações HTTPS

Causa raiz: O token do GitHub era usado apenas para a API do reviewdog, mas não estava configurado para autenticação de operações git (fetch/pull). Com fetch-depth: 2 no checkout, commits mais antigos não estavam disponíveis localmente, causando falha ao tentar fetch.

Cenários testados

  • Antes da correção (com erro)
⚠️  Analisando se as P1s estão em linhas alteradas...
fatal: could not read Username for 'https://github.com': No such device or address
Error: Process completed with exit code 128.

https://github.com/asaasdev/asaas/pull/55852

https://github.com/asaasdev/asaas/actions/runs/21633090397/job/62354435129

image
  • Depois da correção (funcionando)
⚠️  Analisando se as P1s estão em linhas alteradas...
✅ Todas as violações P1 estão fora das linhas alteradas → merge permitido
🏁 Análise de CodeNarc concluída com sucesso.

https://github.com/asaasdev/asaas/pull/56274

https://github.com/asaasdev/asaas/actions/runs/21645188804/job/62395693545

image

Validação de retrocompatibilidade

  • Não há impacto de retrocompatibilidade - mudança isolada no script do CodeNarc Action, token já estava disponível

@anaalves-asaas anaalves-asaas requested a review from a team February 3, 2026 20:05
@anaalves-asaas anaalves-asaas self-assigned this Feb 3, 2026
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

$includes_arg >/dev/null 2>&1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

${INPUT_REVIEWDOG_FLAGS} >/dev/null || true

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

${INPUT_REVIEWDOG_FLAGS} >/dev/null || true

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

${INPUT_REVIEWDOG_FLAGS} >/dev/null || true

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

$includes_arg >/dev/null 2>&1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

${INPUT_REVIEWDOG_FLAGS} >/dev/null || true

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

${INPUT_REVIEWDOG_FLAGS} >/dev/null || true

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

${INPUT_REVIEWDOG_FLAGS} >/dev/null || true

Copy link

@amazon-q-developer amazon-q-developer bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

This PR configures Git authentication to resolve error 128 during git fetch operations. The implementation correctly checks for token presence and configures git to use it for HTTPS operations.

Critical Issue Found

  • Security vulnerability: Current implementation embeds token in git config URL, which can leak in verbose output and error messages

Recommendation

Replace the URL rewrite approach with git credential helper to prevent token exposure in logs while maintaining the same functionality.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

🏷️ [bumpr]
Next version:2.11.0
Changes:2.10.0...asaasdev:corrige-erro-128-codenarc-action

fi

if [ -n "${INPUT_GITHUB_TOKEN}" ]; then
git config --global credential.helper '!f() { echo "username=x-access-token"; echo "password=${INPUT_GITHUB_TOKEN}"; }; f'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Expressions don't expand in single quotes, use double quotes for that. SC2016

@felipeeffting felipeeffting merged commit c0364da into main Feb 4, 2026
13 checks passed
@felipeeffting felipeeffting deleted the corrige-erro-128-codenarc-action branch February 4, 2026 00:07
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

🚀 [bumpr] Bumped!
New version:2.11.0
Changes:2.10.0...2.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants