Class: Fastlane::Actions::EnsureGitStatusCleanAction

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/actions/ensure_git_status_clean.rb

Overview

Raises an exception and stop the lane execution if the repo is not in a clean state

Class Method Summary collapse

Class Method Details

.run(_params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/fastlane/actions/ensure_git_status_clean.rb', line 9

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