paths-filter
paths-filter copied to clipboard
Compare base and ref when token is empty
Description
After we started using paths-filter on all our +80 workflows, we quickly saw API rate limit errors. The exact issue is detailed in both #108 and #73. In our case, this issue would arise pretty quickly considering that each workflow uses paths-filter and thus executes at least one API call. The 1000 requests/hour limit can quickly be met after a dozen of commits.
To alleviate this issue, we considered not using the GitHub API at all. In fact, a simple git diff should be sufficient. The documentation says we can set token to an empty string to force the use of the git command. Doing so resulted in paths-filter executing the git command below. That command would return an excessively large number of modified files (even though they were not modified by PR/commit). The screenshot below exhibits this large number of modified files.
git log --format= --no-renames --name-status -z -n 1

This PR fixes this issue by using getChanges instead of getChangesInLastCommit. Turns out that getChanges is more accurate since we can provide a range that starts at the base and ends at the head/current commit.
We started using this fix in https://github.com/vitessio/vitess/pull/10106. The fix seems to have alleviated all of the issues we were previously seeing.
Related Issues
- https://github.com/dorny/paths-filter/issues/108
- https://github.com/dorny/paths-filter/issues/73
Would love to help moving this forward. Any ideas how @dorny? @frouioui?
@dorny Can this be merged in? Without it we're effectively blocked from using the action on PRs.
I am happy to fix the conflict @dorny if we're good to merge.
@astorrs @frouioui Thanks guys, the PR seems reasonable. I'm sorry that I've overlooked it for so long. I will resolve the conflicts and merge the PR tomorrow.
Released as v3.0.1
Thanks @dorny ! 🙏🏻