Sha256: af1d549e3870e9c8d418a32fb89404f6ff2b06dd2ec9dc9f81af24f7b2db0443

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

module Fastlane
  module Actions
    module SharedValues
    end

    class GitBranchAction < Action
      def self.run(params)
        env_vars = %w(GIT_BRANCH BRANCH_NAME TRAVIS_BRANCH BITRISE_GIT_BRANCH CI_BUILD_REF_NAME)
        env_name = env_vars.find { |env_var| FastlaneCore::Env.truthy?(env_var) }
        ENV.fetch(env_name) { `git symbolic-ref HEAD --short 2>/dev/null`.strip }
      end

      #####################################################
      # @!group Documentation
      #####################################################

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

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

      def self.available_options
        []
      end

      def self.output
        []
      end

      def self.authors
        ["KrauseFx"]
      end

      def self.is_supported?(platform)
        true
      end

      def self.example_code
        [
          'git_branch'
        ]
      end

      def self.category
        :source_control
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fastlane-2.18.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.18.0.beta.20170221010026 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.18.0.beta.20170220010017 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.18.0.beta.20170219010032 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.18.0.beta.20170218010103 fastlane/lib/fastlane/actions/git_branch.rb