2018-11-20 20:47:30 +05:30
|
|
|
# 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]
|
|
|
|
|
|
|
|
result = Tags::CreateService
|
|
|
|
.new(commit.project, current_user)
|
2019-02-15 15:39:39 +05:30
|
|
|
.execute(tag_name, commit.sha, message)
|
2018-11-20 20:47:30 +05:30
|
|
|
|
|
|
|
if result[:status] == :success
|
|
|
|
tag = result[:tag]
|
|
|
|
SystemNoteService.tag_commit(commit, commit.project, current_user, tag.name)
|
|
|
|
end
|
|
|
|
|
|
|
|
result
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|