mirror of
https://github.com/CodelyTV/pr-size-labeler.git
synced 2025-02-15 09:32:48 -05:00
feat: add regex match for files to ignore (#50)
This commit is contained in:
parent
54ef36785e
commit
d269449310
3 changed files with 15 additions and 4 deletions
12
README.md
12
README.md
|
@ -62,8 +62,16 @@ jobs:
|
|||
- `fail_if_xl`: Set to `'true'` will report GitHub Workflow failure if the PR size is xl allowing to forbid PR merge
|
||||
- `message_if_xl`: Let the user(s) know that the PR exceeds the recommended size and what the consequences are
|
||||
- `github_api_url`: Override this parameter in order to use with your own GitHub Enterprise Server. Example: `'https://github.example.com/api/v3'`
|
||||
- `files_to_ignore`: Whitespace separated list of files to ignore when calculating the PR size. Example: `'package-lock.json Pipfile.lock'`
|
||||
|
||||
- `files_to_ignore`: Whitespace or newline separated list of files to ignore when calculating the PR size, regex match is supported.
|
||||
### files_to_ignore Example:
|
||||
```yml
|
||||
files_to_ignore: 'package-lock.json *.lock'
|
||||
# OR
|
||||
files_to_ignore: |
|
||||
"package-lock.json"
|
||||
"*.lock"
|
||||
"docs/*"
|
||||
```
|
||||
## 🤔 Basic concepts or assumptions
|
||||
|
||||
- PR size labeler consider as a change any kind of line addition, deletion, or modification
|
||||
|
|
|
@ -14,7 +14,7 @@ bash --version
|
|||
source "$PR_SIZE_LABELER_HOME/src/main.sh"
|
||||
|
||||
for a in "${@}"; do
|
||||
arg=$(echo "$a" | tr -d '\n'| sed "s/'//g"| sed "s/’//g")
|
||||
arg=$(echo "$a" | tr '\n' ' ' | xargs echo | sed "s/'//g"| sed "s/’//g")
|
||||
sanitizedArgs+=("$arg")
|
||||
done
|
||||
|
||||
|
|
|
@ -21,7 +21,10 @@ github::calculate_total_modifications() {
|
|||
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
|
||||
if [ -z "$file_to_ignore" ]; then
|
||||
continue
|
||||
fi
|
||||
if [[ "$(jq::base64 '.filename')" == $file_to_ignore ]]; then
|
||||
ignore_file=1
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Add table
Reference in a new issue