diff options
Diffstat (limited to 'lib/gitlab/quick_actions/commit_actions.rb')
-rw-r--r-- | lib/gitlab/quick_actions/commit_actions.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/gitlab/quick_actions/commit_actions.rb b/lib/gitlab/quick_actions/commit_actions.rb new file mode 100644 index 00000000000..1018910e8e9 --- /dev/null +++ b/lib/gitlab/quick_actions/commit_actions.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Gitlab + module QuickActions + module CommitActions + extend ActiveSupport::Concern + include Gitlab::QuickActions::Dsl + + included do + # Commit only quick actions definitions + desc _('Tag this commit.') + explanation do |tag_name, message| + 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 + end + 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 |