Class: Fastlane::Actions::SentrySetCommitsAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/sentry/actions/sentry_set_commits.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



90
91
92
# File 'lib/fastlane/plugin/sentry/actions/sentry_set_commits.rb', line 90

def self.authors
  ["brownoxford"]
end

.available_optionsObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/fastlane/plugin/sentry/actions/sentry_set_commits.rb', line 45

def self.available_options
  Helper::SentryConfig.common_api_config_items + [
    FastlaneCore::ConfigItem.new(key: :version,
                                 description: "Release version on Sentry"),
    FastlaneCore::ConfigItem.new(key: :app_identifier,
                                 short_option: "-a",
                                 env_name: "SENTRY_APP_IDENTIFIER",
                                 description: "App Bundle Identifier, prepended to version",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :build,
                                 short_option: "-b",
                                 description: "Release build on Sentry",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :auto,
                                 description: "Enable completely automated commit management",
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :clear,
                                 description: "Clear all current commits from the release",
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :commit,
                                 description: "Commit spec, see `sentry-cli releases help set-commits` for more information",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :ignore_missing,
                                 description: "When enabled, if the previous release commit was not found in the repository, will create a release with the default commits count (or the one specified with `--initial-depth`) instead of failing the command",
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :local,
                                 description: "Set commits of a release from local git. This requires that the command \
                                 is run from within a git repository. sentry-cli will then automatically find \
                                 remotely configured repositories and discover commits",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :initial_depth,
                                 description: "Set the number of commits of the initial release. The default is 20",
                                 type: Integer,
                                 optional: true)
  ]
end

.descriptionObject



34
35
36
# File 'lib/fastlane/plugin/sentry/actions/sentry_set_commits.rb', line 34

def self.description
  "Set commits of a release"
end

.detailsObject



38
39
40
41
42
43
# File 'lib/fastlane/plugin/sentry/actions/sentry_set_commits.rb', line 38

def self.details
  [
    "This action allows you to set commits in a release for a project on Sentry.",
    "See https://docs.sentry.io/cli/releases/#sentry-cli-commit-integration for more information."
  ].join(" ")
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/fastlane/plugin/sentry/actions/sentry_set_commits.rb', line 94

def self.is_supported?(platform)
  true
end

.return_valueObject



86
87
88
# File 'lib/fastlane/plugin/sentry/actions/sentry_set_commits.rb', line 86

def self.return_value
  nil
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fastlane/plugin/sentry/actions/sentry_set_commits.rb', line 4

def self.run(params)
  require 'shellwords'

  Helper::SentryConfig.parse_api_params(params)

  version = params[:version]
  version = "#{params[:app_identifier]}@#{params[:version]}" if params[:app_identifier]
  version = "#{version}+#{params[:build]}" if params[:build]

  command = [
    "releases",
    "set-commits",
    version
  ]

  command.push('--auto') if params[:auto]
  command.push('--clear') if params[:clear]
  command.push('--ignore-missing') if params[:ignore_missing]
  command.push('--local') if params[:local]
  command.push('--initial-depth').push(params[:initial_depth]) unless params[:initial_depth].nil?
  command.push('--commit').push(params[:commit]) unless params[:commit].nil?

  Helper::SentryHelper.call_sentry_cli(params, command)
  UI.success("Successfully set commits for release: #{version}")
end