returnn-experiments
returnn-experiments copied to clipboard
Git commit/push rule to not allow big files
We want to avoid #76 in the future.
One idea was to not allow any files >=10kb (arbitrary limit; but in general, any big files) and enforce that via some Git push hook or so. I'm not sure what methods we have here.
Question on StackOverflow, without a real answer yet, though. However, after some short research, I think sth like this could work:
Maybe via the branch protection rules. I saw some examples that the branch protection rules can include custom status checks. The status checks, these are GitHub actions. So I could maybe add a custom GitHub CI action which checks for a valid commit (valid = any changed file is below the size limit).
I have put some initial code for a GitHub action using adobe/sizewatcher but I'm not really sure whether that can work. Some issue: https://github.com/adobe/sizewatcher/issues/79
Maybe this can not really work like this. The GitHub action runs for pushes, but actually only after the push already has been done, but then it is too late already. It should check it before the push completes and the push itself should fail if this check fails. I'm not sure this is really possible.
I think sizewatcher actually expects that this is done for PRs and it compares to the master branch. Then we would only allows PRs where these checks are passing, and also we would not allow direct pushes to the master branch anymore.
I also asked for such a feature now in the official GitHub community forum.