Class: Fastlane::Actions::IsCheckRequiredAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::IsCheckRequiredAction
- Defined in:
- lib/fastlane/plugin/stream_actions/actions/is_check_required.rb
Documentation collapse
Class Method Summary collapse
Class Method Details
.available_options ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fastlane/plugin/stream_actions/actions/is_check_required.rb', line 28 def self. [ FastlaneCore::ConfigItem.new( key: :sources, description: 'Array of paths to scan', is_string: false, verify_block: proc do |array| UI.user_error!("Sources have to be specified") unless array.kind_of?(Array) && array.size.positive? end ), FastlaneCore::ConfigItem.new( env_name: 'GITHUB_PR_NUM', key: :github_pr_num, description: 'GitHub PR number', optional: true ) ] end |
.description ⇒ Object
24 25 26 |
# File 'lib/fastlane/plugin/stream_actions/actions/is_check_required.rb', line 24 def self.description 'Analyzes the impact of changes on PR' end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fastlane/plugin/stream_actions/actions/is_check_required.rb', line 4 def self.run(params) return true if params[:github_pr_num].nil? || params[:github_pr_num].strip.empty? UI.("Checking if check is required for PR ##{params[:github_pr_num]}") changed_files = Actions.sh("gh pr view #{params[:github_pr_num]} --json files -q '.files[].path'").split("\n") return true if changed_files.size == 100 # TODO: https://github.com/cli/cli/issues/5368 changed_files.select! do |path| params[:sources].any? { |required| path.start_with?(required) } end changed_files.size.positive? end |
.supported?(_platform) ⇒ Boolean
47 48 49 |
# File 'lib/fastlane/plugin/stream_actions/actions/is_check_required.rb', line 47 def self.supported?(_platform) true end |