Sha256: ea0d0e56398b44c401a37943676059b5426805f87b4f3bf58af17db4dafc0b66

Contents?: true

Size: 1.3 KB

Versions: 106

Compression:

Stored size: 1.3 KB

Contents

module Fastlane
  module Actions
    class NumberOfCommitsAction < Action
      def self.is_git?
        Actions.sh 'git rev-parse HEAD'
        return true
      rescue
        return false
      end

      def self.run(params)
        if is_git?
          command = 'git rev-list HEAD --count'
        else
          UI.user_error!("Not in a git repository.")
        end
        return Actions.sh(command).strip.to_i
      end

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

      def self.description
        "Return the total number of all commits in current git repo"
      end

      def self.return_value
        "The total number of all commits in current git repo"
      end

      def self.details
        "You can use this action to get the number of commits of this repo. This is useful if you want to set the build number to the number of commits."
      end

      def self.authors
        ["onevcat"]
      end

      def self.is_supported?(platform)
        true
      end

      def self.example_code
        [
          'build_number = number_of_commits
          increment_build_number(build_number: build_number)'
        ]
      end

      def self.category
        :source_control
      end
    end
  end
end

Version data entries

106 entries across 106 versions & 1 rubygems

Version Path
fastlane-2.5.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.4.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.3.1 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.3.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.2.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.1.3 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.1.2 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.1.1 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.1.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.0.5 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.0.4 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.0.3 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.0.2 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.0.1 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-1.111.0 lib/fastlane/actions/number_of_commits.rb
fastlane-1.110.0 lib/fastlane/actions/number_of_commits.rb
fastlane-1.109.0 lib/fastlane/actions/number_of_commits.rb
fastlane-1.108.0 lib/fastlane/actions/number_of_commits.rb
fastlane-1.107.0 lib/fastlane/actions/number_of_commits.rb
fastlane-1.106.2 lib/fastlane/actions/number_of_commits.rb