class Pantograph::Actions::GitTagExistsAction

Public Class Methods

authors() click to toggle source
# File pantograph/lib/pantograph/actions/git_tag_exists.rb, line 49
def self.authors
  ['johnknapprs']
end
available_options() click to toggle source
# File pantograph/lib/pantograph/actions/git_tag_exists.rb, line 28
def self.available_options
  [
    PantographCore::ConfigItem.new(
      key: :tag,
      env_name: 'GIT_TAG_EXISTS_TAG',
      description: 'The tag name that should be checked',
      is_string: true
    )
  ]
end
category() click to toggle source
# File pantograph/lib/pantograph/actions/git_tag_exists.rb, line 65
def self.category
  :source_control
end
description() click to toggle source

@!group Documentation

# File pantograph/lib/pantograph/actions/git_tag_exists.rb, line 24
def self.description
  'Checks if the git tag with the given name exists'
end
example_code() click to toggle source
# File pantograph/lib/pantograph/actions/git_tag_exists.rb, line 57
def self.example_code
  [
    'if git_tag_exists(tag: "1.1.0")
      UI.message("Git Tag Exists!")
    end'
  ]
end
is_supported?(platform) click to toggle source
# File pantograph/lib/pantograph/actions/git_tag_exists.rb, line 53
def self.is_supported?(platform)
  true
end
output() click to toggle source
# File pantograph/lib/pantograph/actions/git_tag_exists.rb, line 43
def self.output
  [
    ['GIT_TAG_EXISTS', 'Boolean value whether tag exists']
  ]
end
return_value() click to toggle source
# File pantograph/lib/pantograph/actions/git_tag_exists.rb, line 39
def self.return_value
  'Returns Boolean value whether the tag exists'
end
run(params) click to toggle source
# File pantograph/lib/pantograph/actions/git_tag_exists.rb, line 8
def self.run(params)
  tag_exists = true

  Actions.sh(
    "git rev-parse -q --verify refs/tags/#{params[:tag].shellescape}",
    log: PantographCore::Globals.verbose?,
    error_callback: ->(result) { tag_exists = false }
  )

  Actions.lane_context[SharedValues::GIT_TAG_EXISTS] = tag_exists
end