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

update_service.rb « commits « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 45c971d153ad3b245f4fdfee1cd114de668f32f8 (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
27
28
29
# frozen_string_literal: true

module Commits
  class UpdateService < BaseService
    def execute(commit)
      tag_commit(commit)
    end

    private

    def tag_commit(commit)
      # TODO authorize
      return unless params[:tag_name]

      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)
        commit
      end
    end
  end
end