Sha256: 140d27a25b07c91b4309954602a83d3b2ecaabc9c8bec7731415ca4441da31db

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 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
          Helper.log.info 'Git status is clean, all good! 💪'.green
          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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fastlane-0.10.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-0.9.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-0.8.1 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-0.8.0 lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-0.7.0 lib/fastlane/actions/ensure_git_status_clean.rb