diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-01 21:11:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-01 21:11:40 +0300 |
commit | 3bfb19d99e3508b2a42c49d09e5a3236d2ce3a29 (patch) | |
tree | dc3a6a664e81caaa99530260ad56821479a8a939 /app/services/security | |
parent | 18d5458781b21dee4dbb8854c72c064e9bd808ed (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/security')
-rw-r--r-- | app/services/security/ci_configuration/base_create_service.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/services/security/ci_configuration/base_create_service.rb b/app/services/security/ci_configuration/base_create_service.rb index aaa850fde39..3e8865d3dff 100644 --- a/app/services/security/ci_configuration/base_create_service.rb +++ b/app/services/security/ci_configuration/base_create_service.rb @@ -12,6 +12,16 @@ module Security end def execute + if project.repository.empty? && !(@params && @params[:initialize_with_sast]) + docs_link = ActionController::Base.helpers.link_to _('add at least one file to the repository'), + Rails.application.routes.url_helpers.help_page_url('user/project/repository/index.md', + anchor: 'add-files-to-a-repository'), + target: '_blank', + rel: 'noopener noreferrer' + raise Gitlab::Graphql::Errors::MutationError, + _(format('You must %s before using Security features.', docs_link.html_safe)).html_safe + end + project.repository.add_branch(current_user, branch_name, project.default_branch) attributes_for_commit = attributes |