CodelyTV/pr-size-labeler

Misleading/incomplete example and/or confusing semantics for `files_to_ignore` parameter

Opened this issue ยท 0 comments

rhsai commented

The files_to_ignore parameter takes a whitespace delineated list of patterns to ignore when calculating the size of a PR. The example here (https://github.com/CodelyTV/pr-size-labeler?tab=readme-ov-file#example-for-files_to_ignore) shows it being used to ignore lockfiles like package-lock.json file by simply including that filename. Under the hood this is implemented by doing a pattern match against the full path of any file touched by the PR:

for pattern in $files_to_ignore; do
if [[ $filename == $pattern ]]; then
ignore=true
break
fi
done

That means if you want to ignore package-lock.json regardless of where it is located in the repo, you actually need to use */package-lock.json rather than just package-lock.json. I wouldn't necessarily call this a bug, but it has certainly been a point of confusion for some internal users of this action. A more complete example and a note in the parameter description would go a long way towards helping avoid this confusion. Alternatively the implementation could be updated to invoke basename on the path before comparison.

Happy to throw up a PR if there is appetite for either option.


This repo is using Opire - what does it mean? ๐Ÿ‘‡
๐Ÿ’ต Everyone can add rewards for this issue commenting /reward 100 (replace 100 with the amount).
๐Ÿ•ต๏ธโ€โ™‚๏ธ If someone starts working on this issue to earn the rewards, they can comment /try to let everyone know!
๐Ÿ™Œ And when they open the PR, they can comment /claim #88 either in the PR description or in a PR's comment.

๐Ÿช™ Also, everyone can tip any user commenting /tip 20 @rhsai (replace 20 with the amount, and @rhsai with the user to tip).

๐Ÿ“– If you want to learn more, check out our documentation.