mirror of
https://github.com/CodelyTV/pr-size-labeler.git
synced 2025-02-20 12:02:49 -05:00
fix: allow multiples files to ignore (#39)
This commit is contained in:
parent
88ab4d8199
commit
54ef36785e
2 changed files with 9 additions and 5 deletions
|
@ -48,9 +48,9 @@ jobs:
|
||||||
xl_label: 'size/xl'
|
xl_label: 'size/xl'
|
||||||
fail_if_xl: 'false'
|
fail_if_xl: 'false'
|
||||||
message_if_xl: >
|
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.
|
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'
|
github_api_url: 'api.github.com'
|
||||||
files_to_ignore: ''
|
files_to_ignore: ''
|
||||||
```
|
```
|
||||||
|
|
|
@ -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 -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
|
local changes=0
|
||||||
|
|
||||||
for file in $(echo "$body" | jq -r '.[] | @base64'); do
|
for file in $(echo "$body" | jq -r '.[] | @base64'); do
|
||||||
|
local ignore_file=0
|
||||||
for file_to_ignore in $files_to_ignore; do
|
for file_to_ignore in $files_to_ignore; do
|
||||||
if [ "$file_to_ignore" != "$(basename $(jq::base64 '.filename'))" ]; then
|
if [ "$file_to_ignore" = "$(basename $(jq::base64 '.filename'))" ]; then
|
||||||
total_changes=$(jq::base64 '.changes')
|
ignore_file=1
|
||||||
((changes += total_changes))
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [ $ignore_file -eq 0 ]; then
|
||||||
|
((changes += $(jq::base64 '.changes')))
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $changes
|
echo $changes
|
||||||
|
|
Loading…
Add table
Reference in a new issue