Sha256: 32ffbd1ae8933a0838695297252c4558594e6074f0270ab018f5d6d0a5c20f62

Contents?: true

Size: 1.52 KB

Versions: 67

Compression:

Stored size: 1.52 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]
        branch_expr = /#{branch}/
        if Actions.git_branch =~ branch_expr
          Helper.log.info "Git branch match `#{branch}`, all good! 💪".green
        else
          raise "Git is not on a branch matching `#{branch}`. Current branch is `#{Actions.git_branch}`! Please ensure the repo is checked out to the correct branch.".red
        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. String that can be either the full name of the branch or a regex to match",
                                       is_string: true,
                                       default_value: 'master')
        ]
      end

      def self.output
        []
      end

      def self.author
        ['dbachrach', 'Liquidsoul']
      end

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

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
fastlane-1.66.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.65.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.64.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.63.1 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.63.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.62.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.61.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.60.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.59.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.58.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.57.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.56.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.55.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.54.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.53.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.52.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.51.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.50.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.49.0 lib/fastlane/actions/ensure_git_branch.rb
fastlane-1.48.0 lib/fastlane/actions/ensure_git_branch.rb