Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tag_service.rb « commits « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7961ba4d3c4ddf1bd87bfbcaae161e37ce8485bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

module Commits
  class TagService < BaseService
    def execute(commit)
      unless params[:tag_name]
        return error('Missing parameter tag_name')
      end

      tag_name = params[:tag_name]
      message = params[:tag_message]
      release_description = nil

      result = Tags::CreateService
        .new(commit.project, current_user)
        .execute(tag_name, commit.sha, message, release_description)

      if result[:status] == :success
        tag = result[:tag]
        SystemNoteService.tag_commit(commit, commit.project, current_user, tag.name)
      end

      result
    end
  end
end