Skip to content

Commit 99f5ec2

Browse files
committed
ignore verification-metadata.xml in line count
1 parent 8259450 commit 99f5ec2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

scripts/check_pr_size.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ fi
4040

4141
echo "Merge base: $MERGE_BASE"
4242

43+
# Define the files to exclude
44+
EXCLUDE_PATTERN="**/verification-metadata.xml"
45+
4346
# Print the diff statistics from merge base to HEAD (only your changes)
44-
echo "Diff statistics from merge base to HEAD (PR changes only):"
45-
git diff --stat "$MERGE_BASE"..HEAD
47+
echo "Diff statistics from merge base to HEAD (PR changes only), excluding $EXCLUDE_PATTERN:"
48+
git diff --stat "$MERGE_BASE"..HEAD -- . ":(exclude)$EXCLUDE_PATTERN"
4649

4750
# Get the total number of lines changed in the PR from the merge base
48-
CHANGED_LINES=$(git diff --stat "$MERGE_BASE"..HEAD | tail -n1 | awk '{print $4 + $6}')
51+
CHANGED_LINES=$(git diff --numstat "$MERGE_BASE"..HEAD -- . ":(exclude)$EXCLUDE_PATTERN" | awk '{s+=$1; s+=$2} END {print s}')
4952

5053
# Handle cases where no changes are detected
5154
if [[ -z "$CHANGED_LINES" ]]; then
@@ -59,4 +62,4 @@ if [[ "$CHANGED_LINES" -gt "$MAX_LINES" ]]; then
5962
fi
6063

6164
echo "PR size is acceptable: $CHANGED_LINES lines changed."
62-
exit 0
65+
exit 0

0 commit comments

Comments
 (0)