Class: Pantograph::Actions::GitTagExistsAction

Inherits:
Pantograph::Action show all
Defined in:
pantograph/lib/pantograph/actions/git_tag_exists.rb

Defined Under Namespace

Modules: SharedValues

Constant Summary

Constants inherited from Pantograph::Action

Pantograph::Action::AVAILABLE_CATEGORIES, Pantograph::Action::RETURN_TYPES

Documentation collapse

Class Method Summary collapse

Methods inherited from Pantograph::Action

action_name, author, deprecated_notes, details, lane_context, method_missing, other_action, return_type, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject



49
50
51
# File 'pantograph/lib/pantograph/actions/git_tag_exists.rb', line 49

def self.authors
  ['johnknapprs']
end

.available_optionsObject



28
29
30
31
32
33
34
35
36
37
# 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

.categoryObject



65
66
67
# File 'pantograph/lib/pantograph/actions/git_tag_exists.rb', line 65

def self.category
  :source_control
end

.descriptionObject



24
25
26
# 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_codeObject



57
58
59
60
61
62
63
# 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) ⇒ Boolean

Returns:



53
54
55
# File 'pantograph/lib/pantograph/actions/git_tag_exists.rb', line 53

def self.is_supported?(platform)
  true
end

.outputObject



43
44
45
46
47
# File 'pantograph/lib/pantograph/actions/git_tag_exists.rb', line 43

def self.output
  [
    ['GIT_TAG_EXISTS', 'Boolean value whether tag exists']
  ]
end

.return_valueObject



39
40
41
# 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) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# 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