fastlane-plugin-youtrack 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb +96 -0
- data/lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb +31 -22
- data/lib/fastlane/plugin/youtrack/helper/youtrack_helper.rb +14 -0
- data/lib/fastlane/plugin/youtrack/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c62ad905a10c11c2602bd5b4328c69535ec6d872a15724284a6bc53d5d4cb37
|
4
|
+
data.tar.gz: 9928720ad336f1caedaecc4b7dc800cce720236af345bb94baa61925f2504aeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 954b0bc122be8a899fbbd422fb4ff85694e57e00334d937446c3b1e94b5b33a1415606c801f250f0aecb25334ef831c726b61b7f9f24e603acac354a1bcdd07d
|
7
|
+
data.tar.gz: 9a307b74b7b82141c94f81bf8577ea137d2e16685028315b9ccdacd8a234c98de4b6835142fe08dbb510200745a9d5f4e6cdb4696d9b298ed3120e9e3acc548e
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/youtrack_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class YtCommentIssueAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
issue_id = params[:issue_id]
|
9
|
+
comment = params[:comment]
|
10
|
+
base_url = params[:base_url]
|
11
|
+
access_token = params[:access_token]
|
12
|
+
|
13
|
+
result = Helper::YoutrackHelper.comment_issue(issue_id, comment, base_url, access_token)
|
14
|
+
return {} unless result.success?
|
15
|
+
|
16
|
+
begin
|
17
|
+
response_body = JSON.parse(result.body)
|
18
|
+
rescue JSON::ParserError => e
|
19
|
+
puts e
|
20
|
+
end
|
21
|
+
|
22
|
+
response_body
|
23
|
+
rescue => ex
|
24
|
+
UI.error(ex)
|
25
|
+
UI.error('Failed')
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.description
|
29
|
+
'Add a comment to issue by passed identifier'
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.details
|
33
|
+
''
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.available_options
|
37
|
+
[
|
38
|
+
FastlaneCore::ConfigItem.new(
|
39
|
+
key: :issue_id,
|
40
|
+
description: 'Identifier of commented issue',
|
41
|
+
optional: false,
|
42
|
+
type: String
|
43
|
+
),
|
44
|
+
FastlaneCore::ConfigItem.new(
|
45
|
+
key: :comment,
|
46
|
+
description: 'Text of comment',
|
47
|
+
optional: false,
|
48
|
+
type: String
|
49
|
+
),
|
50
|
+
FastlaneCore::ConfigItem.new(
|
51
|
+
key: :base_url,
|
52
|
+
env_name: 'YOUTRACK_BASE_URL',
|
53
|
+
description: 'Base YouTrack URL',
|
54
|
+
optional: false,
|
55
|
+
type: String
|
56
|
+
),
|
57
|
+
FastlaneCore::ConfigItem.new(
|
58
|
+
key: :access_token,
|
59
|
+
env_name: 'YOUTRACK_API_TOKEN',
|
60
|
+
description: 'Access token for YouTrack API',
|
61
|
+
optional: false,
|
62
|
+
type: String
|
63
|
+
)
|
64
|
+
]
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.return_value
|
68
|
+
'Nothing'
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.authors
|
72
|
+
['Semen Kologrivov']
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.is_supported?(_)
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.example_code
|
80
|
+
[
|
81
|
+
'yt_comment_issue(issue_id: "ios_1234", comment: "Lorem ipsum")'
|
82
|
+
]
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.output
|
86
|
+
[
|
87
|
+
[]
|
88
|
+
]
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.return_type
|
92
|
+
:array
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -8,13 +8,14 @@ module Fastlane
|
|
8
8
|
end
|
9
9
|
class YtIssuesInfoAction < Action
|
10
10
|
def self.run(params)
|
11
|
-
|
11
|
+
issue_ids = params[:issue_ids]
|
12
12
|
fields = params[:issue_fields]
|
13
13
|
base_url = params[:base_url]
|
14
14
|
access_token = params[:access_token]
|
15
15
|
|
16
|
-
issues_info =
|
16
|
+
issues_info = issue_ids.map do |issue_id|
|
17
17
|
info = {
|
18
|
+
id: issue_id,
|
18
19
|
url: "#{base_url}/issue/#{issue_id}"
|
19
20
|
}
|
20
21
|
result = Helper::YoutrackHelper.get_issue_info(issue_id, fields, base_url, access_token)
|
@@ -33,7 +34,7 @@ module Fastlane
|
|
33
34
|
|
34
35
|
Actions.lane_context[SharedValues::YOUTRACK_RELEASED_ISSUES] = issues_info
|
35
36
|
|
36
|
-
|
37
|
+
issues_info
|
37
38
|
rescue => ex
|
38
39
|
UI.error(ex)
|
39
40
|
UI.error('Failed')
|
@@ -49,25 +50,33 @@ module Fastlane
|
|
49
50
|
|
50
51
|
def self.available_options
|
51
52
|
[
|
52
|
-
FastlaneCore::ConfigItem.new(
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
53
|
+
FastlaneCore::ConfigItem.new(
|
54
|
+
key: :issue_ids,
|
55
|
+
description: 'Array of issue\'s ids',
|
56
|
+
optional: false,
|
57
|
+
type: Array
|
58
|
+
),
|
59
|
+
FastlaneCore::ConfigItem.new(
|
60
|
+
key: :issue_fields,
|
61
|
+
description: 'Array of neccessary fields of issue',
|
62
|
+
optional: true,
|
63
|
+
default_value: ['summary', 'description'],
|
64
|
+
type: Array
|
65
|
+
),
|
66
|
+
FastlaneCore::ConfigItem.new(
|
67
|
+
key: :base_url,
|
68
|
+
env_name: 'YOUTRACK_BASE_URL',
|
69
|
+
description: 'Base YouTrack URL',
|
70
|
+
optional: false,
|
71
|
+
type: String
|
72
|
+
),
|
73
|
+
FastlaneCore::ConfigItem.new(
|
74
|
+
key: :access_token,
|
75
|
+
env_name: 'YOUTRACK_API_TOKEN',
|
76
|
+
description: 'Access token for YouTrack API',
|
77
|
+
optional: false,
|
78
|
+
type: String
|
79
|
+
)
|
71
80
|
]
|
72
81
|
end
|
73
82
|
|
@@ -19,6 +19,20 @@ module Fastlane
|
|
19
19
|
req.headers['Authorization'] = "Bearer #{token}"
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
def self.comment_issue(issue_id, comment, url, token)
|
24
|
+
Faraday.post("#{url}/api/issues/#{issue_id}/comments") do |req|
|
25
|
+
body = {
|
26
|
+
text: comment
|
27
|
+
}
|
28
|
+
req.body = JSON.generate(body)
|
29
|
+
|
30
|
+
req.headers['Content-Type'] = 'application/json'
|
31
|
+
req.headers['Accept'] = 'application/json'
|
32
|
+
req.headers['Cache-Control'] = 'no-cache'
|
33
|
+
req.headers['Authorization'] = "Bearer #{token}"
|
34
|
+
end
|
35
|
+
end
|
22
36
|
end
|
23
37
|
end
|
24
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-youtrack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Semen Kologrivov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 2.172.0
|
139
139
|
description:
|
140
|
-
email:
|
140
|
+
email: semen@sequenia.com
|
141
141
|
executables: []
|
142
142
|
extensions: []
|
143
143
|
extra_rdoc_files: []
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- LICENSE
|
146
146
|
- README.md
|
147
147
|
- lib/fastlane/plugin/youtrack.rb
|
148
|
+
- lib/fastlane/plugin/youtrack/actions/yt_comment_issue_action.rb
|
148
149
|
- lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb
|
149
150
|
- lib/fastlane/plugin/youtrack/helper/youtrack_helper.rb
|
150
151
|
- lib/fastlane/plugin/youtrack/version.rb
|
@@ -167,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
168
|
- !ruby/object:Gem::Version
|
168
169
|
version: '0'
|
169
170
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
171
|
+
rubygems_version: 3.1.6
|
171
172
|
signing_key:
|
172
173
|
specification_version: 4
|
173
174
|
summary: Use for communicating with YouTrack (fetching issue's info, adding comments
|