2019-03-13 10:45:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module QuickActions
|
|
|
|
module CommitActions
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
include Gitlab::QuickActions::Dsl
|
|
|
|
|
|
|
|
included do
|
|
|
|
# Commit only quick actions definitions
|
2019-04-15 19:24:28 +00:00
|
|
|
desc _('Tag this commit.')
|
2019-03-13 10:45:43 +00:00
|
|
|
explanation do |tag_name, message|
|
2019-04-15 19:24:28 +00:00
|
|
|
if message.present?
|
|
|
|
_("Tags this commit to %{tag_name} with \"%{message}\".") % { tag_name: tag_name, message: message }
|
|
|
|
else
|
|
|
|
_("Tags this commit to %{tag_name}.") % { tag_name: tag_name }
|
|
|
|
end
|
2019-03-13 10:45:43 +00:00
|
|
|
end
|
2019-07-29 22:35:29 +00:00
|
|
|
execution_message do |tag_name, message|
|
|
|
|
if message.present?
|
|
|
|
_("Tagged this commit to %{tag_name} with \"%{message}\".") % { tag_name: tag_name, message: message }
|
|
|
|
else
|
|
|
|
_("Tagged this commit to %{tag_name}.") % { tag_name: tag_name }
|
|
|
|
end
|
|
|
|
end
|
2019-03-13 10:45:43 +00:00
|
|
|
params 'v1.2.3 <message>'
|
|
|
|
parse_params do |tag_name_and_message|
|
|
|
|
tag_name_and_message.split(' ', 2)
|
|
|
|
end
|
|
|
|
types Commit
|
|
|
|
condition do
|
|
|
|
current_user.can?(:push_code, project)
|
|
|
|
end
|
|
|
|
command :tag do |tag_name, message|
|
|
|
|
@updates[:tag_name] = tag_name
|
|
|
|
@updates[:tag_message] = message
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|