Skip to content

Commit

Permalink
fix: allow multiples files to ignore (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezcasas authored Apr 7, 2022
1 parent 88ab4d8 commit 54ef367
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''
```
Expand Down
10 changes: 7 additions & 3 deletions src/github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 54ef367

Please sign in to comment.