Class: Fastlane::Actions::GitBranchAction

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

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, lane_context, method_missing, other_action, return_value, sample_return_value, sh, step_text

Class Method Details

.authorsObject



33
34
35
# File 'lib/fastlane/actions/git_branch.rb', line 33

def self.authors
  ["KrauseFx"]
end

.available_optionsObject



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

def self.available_options
  []
end

.categoryObject



47
48
49
# File 'lib/fastlane/actions/git_branch.rb', line 47

def self.category
  :source_control
end

.descriptionObject



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

def self.description
  "Returns the name of the current git branch"
end

.detailsObject



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

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

.example_codeObject



41
42
43
44
45
# File 'lib/fastlane/actions/git_branch.rb', line 41

def self.example_code
  [
    'git_branch'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/fastlane/actions/git_branch.rb', line 37

def self.is_supported?(platform)
  true
end

.outputObject



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

def self.output
  []
end

.run(params) ⇒ Object



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

def self.run(params)
  return ENV['GIT_BRANCH'] if ENV['GIT_BRANCH']
  return ENV["TRAVIS_BRANCH"] if ENV["TRAVIS_BRANCH"]
  `git symbolic-ref HEAD --short 2>/dev/null`.strip
end