Class: Fastlane::Actions::EnsureGitBranchAction
Overview
Raises an exception and stop the lane execution if the repo is not on a specific branch
Constant Summary
Fastlane::Action::AVAILABLE_CATEGORIES
Class Method Summary
collapse
action_name, authors, lane_context, method_missing, other_action, return_value, sample_return_value, sh, step_text
Class Method Details
.author ⇒ Object
48
49
50
|
# File 'lib/fastlane/actions/ensure_git_branch.rb', line 48
def self.author
['dbachrach', 'Liquidsoul']
end
|
.available_options ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/fastlane/actions/ensure_git_branch.rb', line 34
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
|
.category ⇒ Object
61
62
63
|
# File 'lib/fastlane/actions/ensure_git_branch.rb', line 61
def self.category
:source_control
end
|
.description ⇒ Object
22
23
24
|
# File 'lib/fastlane/actions/ensure_git_branch.rb', line 22
def self.description
"Raises an exception if not on a specific git branch"
end
|
.details ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/fastlane/actions/ensure_git_branch.rb', line 26
def self.details
[
'This action will check if your git repo is checked out to a specific branch.',
'You may only want to make releases from a specific branch, so `ensure_git_branch`',
'will stop a lane if it was accidentally executed on an incorrect branch.'
].join("\n")
end
|
.example_code ⇒ Object
52
53
54
55
56
57
58
59
|
# File 'lib/fastlane/actions/ensure_git_branch.rb', line 52
def self.example_code
[
"ensure_git_branch # defaults to `master` branch",
"ensure_git_branch(
branch: 'develop'
)"
]
end
|
.is_supported?(platform) ⇒ Boolean
65
66
67
|
# File 'lib/fastlane/actions/ensure_git_branch.rb', line 65
def self.is_supported?(platform)
true
end
|
.output ⇒ Object
44
45
46
|
# File 'lib/fastlane/actions/ensure_git_branch.rb', line 44
def self.output
[]
end
|
.run(params) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/fastlane/actions/ensure_git_branch.rb', line 8
def self.run(params)
branch = params[:branch]
branch_expr = /#{branch}/
if Actions.git_branch =~ branch_expr
UI.success("Git branch match `#{branch}`, all good! 💪")
else
UI.user_error!("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.")
end
end
|