Skip to content

Commit 0851a89

Browse files
authored
Cause NotifyMigrateRepository to emit a repo create webhook (#14004)
* Cause NotifyMigrateRepository to emit a repo create webhook This PR simply makes NotifyMigrateRepository emit a Create Repo webhook. The reason for no new payload is that the information sent to NotifyMigrateRepository is only essentially the same as NotifyCreateRepository Fix #13996 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 80a299d commit 0851a89

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

modules/notification/webhook/webhook.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ func (m *webhookNotifier) NotifyDeleteRepository(doer *models.User, repo *models
122122
}
123123
}
124124

125+
func (m *webhookNotifier) NotifyMigrateRepository(doer *models.User, u *models.User, repo *models.Repository) {
126+
// Add to hook queue for created repo after session commit.
127+
if err := webhook_services.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
128+
Action: api.HookRepoCreated,
129+
Repository: convert.ToRepo(repo, models.AccessModeOwner),
130+
Organization: convert.ToUser(u, false, false),
131+
Sender: convert.ToUser(doer, false, false),
132+
}); err != nil {
133+
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err)
134+
}
135+
}
136+
125137
func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee *models.User, removed bool, comment *models.Comment) {
126138
if issue.IsPull {
127139
mode, _ := models.AccessLevelUnit(doer, issue.Repo, models.UnitTypePullRequests)

0 commit comments

Comments
 (0)