mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-17 00:26:07 +10:00
Use Projects::CreateService to create imported projects so hooks are executed.
This commit is contained in:
@@ -10,29 +10,16 @@ module Gitlab
|
||||
end
|
||||
|
||||
def execute
|
||||
@project = Project.new(
|
||||
::Projects::CreateService.new(current_user,
|
||||
name: repo.name,
|
||||
path: repo.name,
|
||||
description: repo.description,
|
||||
namespace: namespace,
|
||||
creator: current_user,
|
||||
namespace_id: namespace.id,
|
||||
visibility_level: repo.private ? Gitlab::VisibilityLevel::PRIVATE : Gitlab::VisibilityLevel::PUBLIC,
|
||||
import_type: "github",
|
||||
import_source: repo.full_name,
|
||||
import_url: repo.clone_url.sub("https://", "https://#{current_user.github_access_token}@")
|
||||
)
|
||||
|
||||
if @project.save!
|
||||
@project.reload
|
||||
|
||||
if @project.import_failed?
|
||||
@project.import_retry
|
||||
else
|
||||
@project.import_start
|
||||
end
|
||||
end
|
||||
|
||||
@project
|
||||
).execute
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user