Sha256: f9c45e41bde084fbe0cf576405129f960a4b18df310eb44ac6d6765b60983652

Contents?: true

Size: 1.06 KB

Versions: 16

Compression:

Stored size: 1.06 KB

Contents

module Fastlane
  module Actions
    module SharedValues
      GIT_REPO_WAS_CLEAN_ON_START = :GIT_REPO_WAS_CLEAN_ON_START
    end

    # Raises an exception and stop the lane execution if the repo is not in a clean state
    class EnsureGitStatusCleanAction < Action
      def self.run(params)
        repo_clean = `git status --porcelain`.empty?

        if repo_clean
          UI.success('Git status is clean, all good! 💪')
          Actions.lane_context[SharedValues::GIT_REPO_WAS_CLEAN_ON_START] = true
        else
          raise 'Git repository is dirty! Please ensure the repo is in a clean state by commiting/stashing/discarding all changes first.'.red
        end
      end

      def self.description
        "Raises an exception if there are uncommited git changes"
      end

      def self.output
        [
          ['GIT_REPO_WAS_CLEAN_ON_START', 'Stores the fact that the git repo was clean at some point']
        ]
      end

      def self.author
        "lmirosevic"
      end

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fastlane-1.89.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.88.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.87.1 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.87.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.86.1 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.86.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.85.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.84.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.83.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.82.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.81.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.80.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.70.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.69.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.68.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-1.67.0 lib/fastlane/actions/ensure_git_status_clean.rb