feat(ci): Add changed lines check#49
Conversation
|
I think this needs override ability. Some PRs have to be very large. And those should also be added to this list MetaMask/metamask-extension#30661 |
@HowardBraham We discussed that PRs larger than this would require an admin override. Is that sufficient for the edge cases? cc @sethkfman |
|
This should probably ignore |
@davidmurdoch Since this is a shared workflow and other repos might not have lavamoat files should we maybe make the regex for exclude files a param that could be passed in from the calling action? |
Yeah, that sounds like the best way to do this. |
Added in new ignore_pattern to the inputs and set |
| run: | | ||
| BASE_BRANCH="${{ steps.get-base-branch.outputs.base_branch }}" | ||
| # Fetch the base branch for comparison | ||
| git fetch origin "$BASE_BRANCH" |
There was a problem hiding this comment.
mmm so we are fetching the entire repo here right? In Extension, we avoided doing a full fetch, and instead we perform a fetch with depth, to optimize the flow here and we also have this function which increments the depth, in case it's needed (for doing the git-diff operation later on)
I'm wondering if we could re-use some of this? Otherwise we are performing a git fetch with depth, but with this flow, were are now also performing a full fetch 🤔
There was a problem hiding this comment.
So would the change here be to update row 46 to git fetch --depth 1 origin "$BASE_BRANCH"? I don't think I need the function referenced but please correct me if I am missing something.
There was a problem hiding this comment.
I think you would need to fetch a depth of more than 1, as you need all commits in-between the base branch and the HEAD to be present. I cannot recall the behavior of git diff when the commits needed for the diff are missing, but surely it will either error or return suboptimal results without the commits present that are needed for the diff. I think it errors.
In the function @seaona linked, we increment the depth until the command git merge-base origin/HEAD HEAD succeeds, as the goal is to at least have commits up to the merge-base present. I believe a similar strategy should work here as well. Except that instead of origin/HEAD we may want to use origin/$BASE_BRANCH.
There was a problem hiding this comment.
I will say though that fetching the whole repository doesn't take that long. Personally I'd consider this a non-blocking suggestion/optimization, which we could do later.
- Added incremental shallow fetches with depths 1, 10, and 100 to avoid a full repo fetch. - Implemented logic to detect when the merge-base is available using the fetched commits. - Fall back to fetching the full history (unshallow) if necessary to ensure proper diff calculation.
We (MMIG eng) have decided that PRs greater than 1000 lines are too big and need to be broken down, thus this check will be used in
metamask-extension,metamask-mobileandcoreto prevent PRs which are too big.https://github.com/MetaMask/MetaMask-planning/issues/3739