Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading/incomplete example and/or confusing semantics for files_to_ignore parameter #88

Open
rhsai opened this issue Oct 28, 2024 · 0 comments

Comments

@rhsai
Copy link

rhsai commented Oct 28, 2024

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant