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

Git commit/push rule to not allow big files #77

Open
albertz opened this issue Jun 10, 2022 · 3 comments
Open

Git commit/push rule to not allow big files #77

albertz opened this issue Jun 10, 2022 · 3 comments

Comments

@albertz
Copy link
Member

albertz commented Jun 10, 2022

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.

@albertz
Copy link
Member Author

albertz commented Jun 13, 2022

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).

@albertz
Copy link
Member Author

albertz commented Jun 13, 2022

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: adobe/sizewatcher#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.

@albertz
Copy link
Member Author

albertz commented Jun 13, 2022

I also asked for such a feature now in the official GitHub community forum.

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