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
12 changes: 11 additions & 1 deletion scripts/ci/run-diff-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@ fi

current_branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)"
github_ref_name="${GITHUB_REF_NAME:-}"
github_ref="${GITHUB_REF:-}"
compare_ref="${compare_branch#origin/}"
if [[ -z "$base_ref" && ( "$current_branch" == "$compare_ref" || "$github_ref_name" == "$compare_ref" ) ]]; then
head_sha="$(git rev-parse HEAD 2>/dev/null || true)"
compare_sha="$(git rev-parse "$compare_branch" 2>/dev/null || true)"
is_default_branch_run=false
if [[ "$current_branch" == "$compare_ref" || "$github_ref_name" == "$compare_ref" || "$github_ref" == "refs/heads/$compare_ref" ]]; then
is_default_branch_run=true
elif [[ -n "$head_sha" && "$head_sha" == "$compare_sha" ]]; then
is_default_branch_run=true
fi

if [[ -z "$base_ref" && "$is_default_branch_run" == "true" ]]; then
echo "Default branch coverage run detected; skipping diff coverage."
exit 0
fi
Expand Down
Loading