Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions entrypoint.sh
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

Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,24 @@ run_reviewdog() {

generate_git_diff() {
if [ -n "$GITHUB_BASE_SHA" ] && [ -n "$GITHUB_HEAD_SHA" ]; then
git fetch origin "$GITHUB_BASE_SHA" --depth=1 >/dev/null 2>&1 || true
git fetch origin "$GITHUB_HEAD_SHA" --depth=1 >/dev/null 2>&1 || true
git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy'
if git cat-file -e "$GITHUB_BASE_SHA" 2>/dev/null && git cat-file -e "$GITHUB_HEAD_SHA" 2>/dev/null; then
git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy' 2>&1

Choose a reason for hiding this comment

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

The git diff command should include error handling to prevent silent failures when the diff operation fails.

Suggested change
git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy' 2>&1
git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy' 2>&1 || return 1

else
git fetch origin "$GITHUB_BASE_SHA" --depth=1 2>&1 || true
git fetch origin "$GITHUB_HEAD_SHA" --depth=1 2>&1 || true
git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy' 2>&1

Choose a reason for hiding this comment

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

The git diff command should include error handling to prevent silent failures when the diff operation fails.

Suggested change
git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy' 2>&1
git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy' 2>&1 || return 1

fi
else
git diff -U0 HEAD~1 -- '*.groovy'
git diff -U0 HEAD~1 -- '*.groovy' 2>&1

Choose a reason for hiding this comment

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

The git diff command should include error handling to prevent silent failures when the diff operation fails.

Suggested change
git diff -U0 HEAD~1 -- '*.groovy' 2>&1
git diff -U0 HEAD~1 -- '*.groovy' 2>&1 || return 1

fi
}

build_changed_lines_cache() {
true > "$CHANGED_FILES_CACHE"
true > "$CHANGED_LINES_CACHE"

generate_git_diff > "$ALL_DIFF" 2>/dev/null || return
[ ! -s "$ALL_DIFF" ] && return
generate_git_diff > "$ALL_DIFF" 2>&1
[ ! -s "$ALL_DIFF" ] && return 1

awk '
BEGIN { file = ""; line_num = 0 }
Expand Down Expand Up @@ -185,12 +189,9 @@ check_blocking_rules() {

echo ""
echo "⚠️ Analisando se as P1s estão em linhas alteradas..."
build_changed_lines_cache

if [ ! -s "$ALL_DIFF" ]; then
echo ""
echo "⚠️ Diff vazio: Sem informações de linhas alteradas. Todas as P1s são consideradas bloqueantes."
echo "💡 Corrija as violações ou use um bypass autorizado."

if ! build_changed_lines_cache || [ ! -s "$ALL_DIFF" ]; then
echo "❌ Não foi possível gerar diff. Todas as P1s serão consideradas bloqueantes."
exit 1
fi

Expand Down
Loading