Sha256: 2b34b94c9537010e9cdb0cb5728ee2ea929f690259cefe47d3546e66483a6c0f

Contents?: true

Size: 1.14 KB

Versions: 14

Compression:

Stored size: 1.14 KB

Contents

module Fastlane
  module Actions
    module SharedValues
    end

    class GitBranchAction < Action
      def self.run(params)
        return ENV['GIT_BRANCH'] if FastlaneCore::Env.truthy?('GIT_BRANCH')
        return ENV["TRAVIS_BRANCH"] if FastlaneCore::Env.truthy?("TRAVIS_BRANCH")
        return ENV["BITRISE_GIT_BRANCH"] if FastlaneCore::Env.truthy?("BITRISE_GIT_BRANCH")
        `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

14 entries across 14 versions & 1 rubygems

Version Path
fastlane-2.12.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.11.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.10.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.9.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.8.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.7.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.6.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.5.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.4.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.3.1 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.3.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.2.0 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.1.3 fastlane/lib/fastlane/actions/git_branch.rb
fastlane-2.1.2 fastlane/lib/fastlane/actions/git_branch.rb