fastlane-plugin-accessibility_test 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 829198c50e36917c0f533858fc1424793a394725cb4e8181847ab97802bc0b04
|
4
|
+
data.tar.gz: 6a70ba9f997bc100179ccb708457912988ac3a6820f9b1129fbba443804326b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60096368ff51b7eef3b86fd56e29a3f909bd0c920969a1029f7d9ce36899da55d4ed6127c5fd0b46a9c3103957679590020a70a28021be7b5940ce90b5b41a3e
|
7
|
+
data.tar.gz: 3cb42f6d5f3458c9ee0279b6db0dcb16984afcee1c532cd4d93cdf36aba16685541359c407083ced28c3ee72b904b902c34e87a0dfc418dd30564bf6a91c6ce6
|
@@ -104,6 +104,15 @@ module Fastlane
|
|
104
104
|
EOS
|
105
105
|
|
106
106
|
UI.message message
|
107
|
+
|
108
|
+
GitHubNotifier.fold_comments(
|
109
|
+
params[:github_owner],
|
110
|
+
params[:github_repository],
|
111
|
+
params[:github_pr_number],
|
112
|
+
"## Accessibility Test Result",
|
113
|
+
"Open past accessibility test result",
|
114
|
+
params[:github_api_token]
|
115
|
+
)
|
107
116
|
GitHubNotifier.put_comment(
|
108
117
|
params[:github_owner],
|
109
118
|
params[:github_repository],
|
@@ -5,6 +5,38 @@ require 'uri'
|
|
5
5
|
|
6
6
|
module Fastlane
|
7
7
|
module GitHubNotifier
|
8
|
+
def self.fold_comments(github_owner, github_repository, github_pr_number, comment_prefix, summary, github_api_token)
|
9
|
+
res = get_comments(github_owner, github_repository, github_pr_number, github_api_token)
|
10
|
+
JSON.parse(res.body)
|
11
|
+
.select {|comment| comment["body"].start_with?(comment_prefix)}
|
12
|
+
.each {|comment|
|
13
|
+
body = "<details><summary>#{summary}</summary>\n#{comment["body"]}\n\n</details>\n"
|
14
|
+
patch_comment(github_owner, github_repository, comment["id"], body, github_api_token)
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.delete_comments(github_owner, github_repository, github_pr_number, comment_prefix, github_api_token)
|
19
|
+
res = get_comments(github_owner, github_repository, github_pr_number, github_api_token)
|
20
|
+
JSON.parse(res.body)
|
21
|
+
.select {|comment| comment["body"].start_with?(comment_prefix)}
|
22
|
+
.each {|comment| delete_comment(github_owner, github_repository, comment["id"], github_api_token)}
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.get_comments(github_owner, github_repository, github_pr_number, github_api_token)
|
26
|
+
api_url = "https://api.github.com/repos/#{github_owner}/#{github_repository}/issues/#{github_pr_number}/comments"
|
27
|
+
UI.message "get comments #{api_url}"
|
28
|
+
|
29
|
+
uri = URI.parse(api_url)
|
30
|
+
req = Net::HTTP::Get.new(uri)
|
31
|
+
req["Content-Type"] = "application/json"
|
32
|
+
req["Authorization"] = "token #{github_api_token}"
|
33
|
+
|
34
|
+
res = Net::HTTP.start(uri.hostname, uri.port, {use_ssl: uri.scheme = "https"}) {|http| http.request(req)}
|
35
|
+
UI.message "#{res.code}\n#{res.body}"
|
36
|
+
|
37
|
+
res
|
38
|
+
end
|
39
|
+
|
8
40
|
def self.put_comment(github_owner, github_repository, github_pr_number, body, github_api_token)
|
9
41
|
api_url = "https://api.github.com/repos/#{github_owner}/#{github_repository}/issues/#{github_pr_number}/comments"
|
10
42
|
UI.message "put comment #{api_url}"
|
@@ -20,5 +52,36 @@ module Fastlane
|
|
20
52
|
|
21
53
|
res
|
22
54
|
end
|
55
|
+
|
56
|
+
def self.patch_comment(github_owner, github_repository, comment_id, body, github_api_token)
|
57
|
+
api_url = "https://api.github.com/repos/#{github_owner}/#{github_repository}/issues/comments/#{comment_id}"
|
58
|
+
UI.message "patch comment #{api_url}"
|
59
|
+
|
60
|
+
uri = URI.parse(api_url)
|
61
|
+
req = Net::HTTP::Patch.new(uri)
|
62
|
+
req["Content-Type"] = "application/json"
|
63
|
+
req["Authorization"] = "token #{github_api_token}"
|
64
|
+
req.body = {:body => body}.to_json
|
65
|
+
|
66
|
+
res = Net::HTTP.start(uri.hostname, uri.port, {use_ssl: uri.scheme = "https"}) {|http| http.request(req)}
|
67
|
+
UI.message "#{res.code}\n#{res.body}"
|
68
|
+
|
69
|
+
res
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.delete_comment(github_owner, github_repository, comment_id, github_api_token)
|
73
|
+
api_url = "https://api.github.com/repos/#{github_owner}/#{github_repository}/issues/comments/#{comment_id}"
|
74
|
+
UI.message "delete comment #{api_url}"
|
75
|
+
|
76
|
+
uri = URI.parse(api_url)
|
77
|
+
req = Net::HTTP::Delete.new(uri)
|
78
|
+
req["Content-Type"] = "application/json"
|
79
|
+
req["Authorization"] = "token #{github_api_token}"
|
80
|
+
|
81
|
+
res = Net::HTTP.start(uri.hostname, uri.port, {use_ssl: uri.scheme = "https"}) {|http| http.request(req)}
|
82
|
+
UI.message "#{res.code}\n#{res.body}"
|
83
|
+
|
84
|
+
res
|
85
|
+
end
|
23
86
|
end
|
24
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-accessibility_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takeshi Tsukamoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|