class Fastlane::Actions::GitTagExistsAction

Public Class Methods

authors() click to toggle source
# File fastlane/lib/fastlane/actions/git_tag_exists.rb, line 57
def self.authors
  ["antondomashnev"]
end
available_options() click to toggle source
# File fastlane/lib/fastlane/actions/git_tag_exists.rb, line 28
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :tag,
                                 description: "The tag name that should be checked"),
    FastlaneCore::ConfigItem.new(key: :remote,
                                 description: "Whether to check remote. Defaults to `false`",
                                 type: Boolean,
                                 default_value: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :remote_name,
                                 description: "The remote to check. Defaults to `origin`",
                                 default_value: 'origin',
                                 optional: true)
  ]
end
category() click to toggle source
# File fastlane/lib/fastlane/actions/git_tag_exists.rb, line 73
def self.category
  :source_control
end
description() click to toggle source

@!group Documentation

# File fastlane/lib/fastlane/actions/git_tag_exists.rb, line 24
def self.description
  "Checks if the git tag with the given name exists in the current repo"
end
example_code() click to toggle source
# File fastlane/lib/fastlane/actions/git_tag_exists.rb, line 65
def self.example_code
  [
    'if git_tag_exists(tag: "1.1.0")
      UI.message("Found it 🚀")
    end'
  ]
end
is_supported?(platform) click to toggle source
# File fastlane/lib/fastlane/actions/git_tag_exists.rb, line 61
def self.is_supported?(platform)
  true
end
output() click to toggle source
# File fastlane/lib/fastlane/actions/git_tag_exists.rb, line 52
def self.output
  [
  ]
end
return_type() click to toggle source
# File fastlane/lib/fastlane/actions/git_tag_exists.rb, line 48
def self.return_type
  :bool
end
return_value() click to toggle source
# File fastlane/lib/fastlane/actions/git_tag_exists.rb, line 44
def self.return_value
  "Boolean value whether the tag exists or not"
end
run(params) click to toggle source
# File fastlane/lib/fastlane/actions/git_tag_exists.rb, line 4
def self.run(params)
  tag_ref = "refs/tags/#{params[:tag].shellescape}"
  if params[:remote]
    command = "git ls-remote -q --exit-code #{params[:remote_name].shellescape} #{tag_ref}"
  else
    command = "git rev-parse -q --verify #{tag_ref}"
  end
  exists = true
  Actions.sh(
    command,
    log: FastlaneCore::Globals.verbose?,
    error_callback: ->(result) { exists = false }
  )
  exists
end