Skip to content

Commit 2f2dbd9

Browse files
add logs para diagnostico
1 parent 523ebf7 commit 2f2dbd9

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

entrypoint.sh

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,9 @@ run_reviewdog() {
9090

9191
generate_git_diff() {
9292
if [ -n "$GITHUB_BASE_SHA" ] && [ -n "$GITHUB_HEAD_SHA" ]; then
93-
# Verifica se os SHAs já existem localmente
9493
if git cat-file -e "$GITHUB_BASE_SHA" 2>/dev/null && git cat-file -e "$GITHUB_HEAD_SHA" 2>/dev/null; then
9594
git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy' 2>&1
9695
else
97-
echo "⚠️ SHAs não encontrados localmente, tentando fetch..." >&2
9896
git fetch origin "$GITHUB_BASE_SHA" --depth=1 2>&1 || true
9997
git fetch origin "$GITHUB_HEAD_SHA" --depth=1 2>&1 || true
10098
git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy' 2>&1
@@ -109,13 +107,7 @@ build_changed_lines_cache() {
109107
true > "$CHANGED_LINES_CACHE"
110108

111109
generate_git_diff > "$ALL_DIFF" 2>&1
112-
113-
if [ ! -s "$ALL_DIFF" ]; then
114-
echo "⚠️ Diff vazio gerado" >&2
115-
return 1
116-
fi
117-
118-
echo "✅ Diff gerado com sucesso ($(wc -l < "$ALL_DIFF") linhas)"
110+
[ ! -s "$ALL_DIFF" ] && return 1
119111

120112
awk '
121113
BEGIN { file = ""; line_num = 0 }
@@ -198,16 +190,8 @@ check_blocking_rules() {
198190
echo ""
199191
echo "⚠️ Analisando se as P1s estão em linhas alteradas..."
200192

201-
if ! build_changed_lines_cache; then
202-
echo "❌ Não foi possível gerar diff das alterações"
203-
echo "💡 Todas as P1s serão consideradas bloqueantes"
204-
exit 1
205-
fi
206-
207-
if [ ! -s "$ALL_DIFF" ]; then
208-
echo ""
209-
echo "⚠️ Diff vazio: Sem informações de linhas alteradas. Todas as P1s são consideradas bloqueantes."
210-
echo "💡 Corrija as violações ou use um bypass autorizado."
193+
if ! build_changed_lines_cache || [ ! -s "$ALL_DIFF" ]; then
194+
echo "❌ Não foi possível gerar diff. Todas as P1s serão consideradas bloqueantes."
211195
exit 1
212196
fi
213197

0 commit comments

Comments
 (0)