class Fastlane::Actions::AuDangerGitlabAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/au_danger_gitlab/actions/au_danger_gitlab_action.rb, line 25
def self.authors
  ["SzymonMrozek", "emilwojtaszek"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/au_danger_gitlab/actions/au_danger_gitlab_action.rb, line 38
def self.available_options
  [
    # FastlaneCore::ConfigItem.new(key: :your_option,
    #                         env_name: "AU_DANGER_GITLAB_YOUR_OPTION",
    #                      description: "A description of your option",
    #                         optional: false,
    #                             type: String)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/au_danger_gitlab/actions/au_danger_gitlab_action.rb, line 21
def self.description
  "Allows to use Danger on GitLab"
end
details() click to toggle source
# File lib/fastlane/plugin/au_danger_gitlab/actions/au_danger_gitlab_action.rb, line 33
def self.details
  # Optional:
  "This plugin allows you to use Danger on GitLab by adding CI_MERGE_REQUEST_ID environment value"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/au_danger_gitlab/actions/au_danger_gitlab_action.rb, line 48
def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/au_danger_gitlab/actions/au_danger_gitlab_action.rb, line 29
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/au_danger_gitlab/actions/au_danger_gitlab_action.rb, line 7
def self.run(params)
  # UI.message("The au_danger_gitlab plugin is working!")
  remotes = sh("git ls-remote -q origin merge-requests\\*head|grep #{ENV['CI_COMMIT_SHA']}")
  match_data = /.*merge-requests\/([0-9]+)\//.match(remotes)
  if match_data && match_data[1]
    ENV['CI_MERGE_REQUEST_ID'] = match_data[1] 
    UI.message("Adding `CI_MERGE_REQUEST_ID` to ENVs")
    return true
  end

  UI.message("Not a merge request, exiting...")
  return false        
end