Fix codeowner detected diff base branch to mergebase (#29783)

Fix #29763

This PR fixes 2 problems with CodeOwner in the pull request.
- Don't use the pull request base branch but merge-base as a diff base to
detect the code owner.
- CodeOwner detection in fork repositories will be disabled because
almost all the fork repositories will not change CODEOWNERS files but it
should not be used on fork repositories' pull requests.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Lunny Xiao 2024-03-15 13:13:09 +08:00 committed by GitHub
parent 0827552d9a
commit 277f90d416
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 248 additions and 74 deletions

View file

@ -136,7 +136,7 @@ func NewPullRequest(ctx context.Context, repo *repo_model.Repository, issue *iss
}
if !pr.IsWorkInProgress(ctx) {
if err := issues_model.PullRequestCodeOwnersReview(ctx, issue, pr); err != nil {
if err := issue_service.PullRequestCodeOwnersReview(ctx, issue, pr); err != nil {
return err
}
}