diff --git a/README.md b/README.md index de2da36..b068ff5 100644 --- a/README.md +++ b/README.md @@ -48,9 +48,9 @@ jobs: xl_label: 'size/xl' fail_if_xl: 'false' message_if_xl: > - 'This PR exceeds the recommended size of 1000 lines. + This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. - Note this PR might be rejected due to its size.’ + Note this PR might be rejected due to its size. github_api_url: 'api.github.com' files_to_ignore: '' ``` diff --git a/src/github.sh b/src/github.sh index 2e648c1..8a31030 100644 --- a/src/github.sh +++ b/src/github.sh @@ -17,13 +17,17 @@ github::calculate_total_modifications() { 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") local changes=0 + for file in $(echo "$body" | jq -r '.[] | @base64'); do + local ignore_file=0 for file_to_ignore in $files_to_ignore; do - if [ "$file_to_ignore" != "$(basename $(jq::base64 '.filename'))" ]; then - total_changes=$(jq::base64 '.changes') - ((changes += total_changes)) + if [ "$file_to_ignore" = "$(basename $(jq::base64 '.filename'))" ]; then + ignore_file=1 fi done + if [ $ignore_file -eq 0 ]; then + ((changes += $(jq::base64 '.changes'))) + fi done echo $changes