Skip to content

Commit 54ef367

Browse files
authored
fix: allow multiples files to ignore (#39)
1 parent 88ab4d8 commit 54ef367

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ jobs:
4848
xl_label: 'size/xl'
4949
fail_if_xl: 'false'
5050
message_if_xl: >
51-
'This PR exceeds the recommended size of 1000 lines.
51+
This PR exceeds the recommended size of 1000 lines.
5252
Please make sure you are NOT addressing multiple issues with one PR.
53-
Note this PR might be rejected due to its size.
53+
Note this PR might be rejected due to its size.
5454
github_api_url: 'api.github.com'
5555
files_to_ignore: ''
5656
```

src/github.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ github::calculate_total_modifications() {
1717
local -r body=$(curl -sSL -H "Authorization: token $GITHUB_TOKEN" -H "$GITHUB_API_HEADER" "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/$pr_number/files?per_page=100")
1818

1919
local changes=0
20+
2021
for file in $(echo "$body" | jq -r '.[] | @base64'); do
22+
local ignore_file=0
2123
for file_to_ignore in $files_to_ignore; do
22-
if [ "$file_to_ignore" != "$(basename $(jq::base64 '.filename'))" ]; then
23-
total_changes=$(jq::base64 '.changes')
24-
((changes += total_changes))
24+
if [ "$file_to_ignore" = "$(basename $(jq::base64 '.filename'))" ]; then
25+
ignore_file=1
2526
fi
2627
done
28+
if [ $ignore_file -eq 0 ]; then
29+
((changes += $(jq::base64 '.changes')))
30+
fi
2731
done
2832

2933
echo $changes

0 commit comments

Comments
 (0)