Class: Fastlane::Actions::GitBranchAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/git_branch.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, deprecated_notes, lane_context, method_missing, other_action, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject



35
36
37
# File 'fastlane/lib/fastlane/actions/git_branch.rb', line 35

def self.authors
  ["KrauseFx"]
end

.available_optionsObject



25
26
27
# File 'fastlane/lib/fastlane/actions/git_branch.rb', line 25

def self.available_options
  []
end

.categoryObject



53
54
55
# File 'fastlane/lib/fastlane/actions/git_branch.rb', line 53

def self.category
  :source_control
end

.descriptionObject



17
18
19
# File 'fastlane/lib/fastlane/actions/git_branch.rb', line 17

def self.description
  "Returns the name of the current git branch, possibly as managed by CI ENV vars"
end

.detailsObject



21
22
23
# File 'fastlane/lib/fastlane/actions/git_branch.rb', line 21

def self.details
  "If no branch could be found, this action will return an empty string"
end

.example_codeObject



43
44
45
46
47
# File 'fastlane/lib/fastlane/actions/git_branch.rb', line 43

def self.example_code
  [
    'git_branch'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



39
40
41
# File 'fastlane/lib/fastlane/actions/git_branch.rb', line 39

def self.is_supported?(platform)
  true
end

.outputObject



29
30
31
32
33
# File 'fastlane/lib/fastlane/actions/git_branch.rb', line 29

def self.output
  [
    ['GIT_BRANCH_ENV_VARS', 'The git branch environment variables']
  ]
end

.return_typeObject



49
50
51
# File 'fastlane/lib/fastlane/actions/git_branch.rb', line 49

def self.return_type
  :string
end

.run(params) ⇒ Object



8
9
10
11
# File 'fastlane/lib/fastlane/actions/git_branch.rb', line 8

def self.run(params)
  env_name = SharedValues::GIT_BRANCH_ENV_VARS.find { |env_var| FastlaneCore::Env.truthy?(env_var) }
  ENV.fetch(env_name.to_s) { `git symbolic-ref HEAD --short 2>/dev/null`.strip }
end