Class: Fastlane::Actions::YtCommentIssueAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



71
72
73
# File 'lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb', line 71

def self.authors
  ['Semen Kologrivov']
end

.available_optionsObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb', line 36

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :issue_id,
      description: 'Identifier of commented issue',
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :comment,
      description: 'Text of comment',
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :base_url,
      env_name: 'YOUTRACK_BASE_URL',
      description: 'Base YouTrack URL',
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :access_token,
      env_name: 'YOUTRACK_API_TOKEN',
      description: 'Access token for YouTrack API',
      optional: false,
      type: String
    )
  ]
end

.descriptionObject



28
29
30
# File 'lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb', line 28

def self.description
  'Add a comment to issue by passed identifier'
end

.detailsObject



32
33
34
# File 'lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb', line 32

def self.details
  ''
end

.example_codeObject



79
80
81
82
83
# File 'lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb', line 79

def self.example_code
  [
    'yt_comment_issue(issue_id: "ios_1234", comment: "Lorem ipsum")'
  ]
end

.is_supported?(_) ⇒ Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb', line 75

def self.is_supported?(_)
  true
end

.outputObject



85
86
87
88
89
# File 'lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb', line 85

def self.output
  [
    []
  ]
end

.return_typeObject



91
92
93
# File 'lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb', line 91

def self.return_type
  :array
end

.return_valueObject



67
68
69
# File 'lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb', line 67

def self.return_value
  'Nothing'
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb', line 7

def self.run(params)
  issue_id = params[:issue_id]
  comment = params[:comment]
  base_url = params[:base_url]
  access_token = params[:access_token]

  result = Helper::YoutrackHelper.comment_issue(issue_id, comment, base_url, access_token)
  return {} unless result.success?

  begin
    response_body = JSON.parse(result.body)
  rescue JSON::ParserError => e
    puts e
  end

  response_body
rescue => ex
  UI.error(ex)
  UI.error('Failed')
end