class Fastlane::Actions::NumberOfCommitsAction
Public Class Methods
available_options()
click to toggle source
# File fastlane/lib/fastlane/actions/number_of_commits.rb, line 40 def self.available_options [ FastlaneCore::ConfigItem.new(key: :all, env_name: "FL_NUMBER_OF_COMMITS_ALL", optional: true, type: Boolean, description: "Returns number of all commits instead of current branch") ] end
category()
click to toggle source
# File fastlane/lib/fastlane/actions/number_of_commits.rb, line 70 def self.category :source_control end
description()
click to toggle source
@!group Documentation
# File fastlane/lib/fastlane/actions/number_of_commits.rb, line 28 def self.description "Return the number of commits in current git branch" end
details()
click to toggle source
# File fastlane/lib/fastlane/actions/number_of_commits.rb, line 50 def self.details "You can use this action to get the number of commits of this branch. This is useful if you want to set the build number to the number of commits. See `fastlane actions number_of_commits` for more details." end
example_code()
click to toggle source
# File fastlane/lib/fastlane/actions/number_of_commits.rb, line 62 def self.example_code [ 'increment_build_number(build_number: number_of_commits)', 'build_number = number_of_commits(all: true) increment_build_number(build_number: build_number)' ] end
is_git?()
click to toggle source
# File fastlane/lib/fastlane/actions/number_of_commits.rb, line 4 def self.is_git? Actions.sh('git rev-parse HEAD') return true rescue return false end
is_supported?(platform)
click to toggle source
# File fastlane/lib/fastlane/actions/number_of_commits.rb, line 58 def self.is_supported?(platform) true end
return_type()
click to toggle source
# File fastlane/lib/fastlane/actions/number_of_commits.rb, line 36 def self.return_type :int end
return_value()
click to toggle source
# File fastlane/lib/fastlane/actions/number_of_commits.rb, line 32 def self.return_value "The total number of all commits in current git branch" end
run(params)
click to toggle source
# File fastlane/lib/fastlane/actions/number_of_commits.rb, line 11 def self.run(params) if is_git? if params[:all] command = 'git rev-list --all --count' else command = 'git rev-list HEAD --count' end else UI.user_error!("Not in a git repository.") end return Actions.sh(command).strip.to_i end