Sha256: 32c6ef8deaf608009ef6c1dd31de8803c02af95022307c8770923b030fc3b649

Contents?: true

Size: 1.37 KB

Versions: 15

Compression:

Stored size: 1.37 KB

Contents

module Fastlane
  module Actions
    module SharedValues
    end

    # Raises an exception and stop the lane execution if the repo is not on a specific branch
    class EnsureGitBranchAction < Action
      def self.run(params)
        branch = params[:branch]
        if Actions.git_branch != branch
          raise "Git is not on the `#{branch}` branch, but on `#{Actions.git_branch}`! Please ensure the repo is checked out to the correct branch.".red
        else
          Helper.log.info "Git branch is `#{branch}`, all good! 💪".green
        end
      end


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

      def self.description
        "Raises an exception if not on a specific git branch"
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :branch,
                                       env_name: "FL_ENSURE_GIT_BRANCH_NAME",
                                       description: "The branch that should be checked for",
                                       is_string: true,
                                       default_value: 'master'),
        ]
      end

      def self.output
        []
      end

      def self.author
        'dbachrach'
      end

      def self.is_supported?(platform)
        true
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fastlane-1.20.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.19.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.18.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.17.1 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.17.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.16.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.15.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.14.1 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.14.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.13.1 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.13.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.12.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.11.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.10.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.9.0 lib/fastlane/actions/ensure_git_branch.rb