Skip to content

Don't try to close related PRs when deleting a non-fork repository #14777

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions services/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ func ForkRepository(doer, u *models.User, oldRepo *models.Repository, name, desc

// DeleteRepository deletes a repository for a user or organization.
func DeleteRepository(doer *models.User, repo *models.Repository) error {
if err := pull_service.CloseRepoBranchesPulls(doer, repo); err != nil {
log.Error("CloseRepoBranchesPulls failed: %v", err)
// Only when deleting a fork repository, we should close all PRs related
// For un-fork repository, close pulls is unnecessary
if repo.IsFork {
if err := pull_service.CloseRepoBranchesPulls(doer, repo); err != nil {
log.Error("CloseRepoBranchesPulls failed: %v", err)
}
}

// If the repo itself has webhooks, we need to trigger them before deleting it...
Expand Down