fbe 0.13.0 → 0.14.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/.github/.typos.toml +6 -0
- data/.github/workflows/typos.yml +2 -0
- data/lib/fbe/github_graph.rb +144 -0
- data/lib/fbe/octo.rb +26 -0
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_github_graph.rb +27 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3014cee4d698164150c3588438c2c6e5b5b52619adafe6c6a16511ac14cfbe3d
|
4
|
+
data.tar.gz: aae4764232e4bfddc86b40385fdca9feab141bcf64790d3df3366f99e403fe34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 133bf5f80ec894aa9c1a67d291e504745a307cc80a9765078670df59dff58658544e84a765060fb0b0e423b94abaf77bda45c72a7594dbb31c655c0211f7974d
|
7
|
+
data.tar.gz: cb4b5ff642038f99264c0df676e251fff87fe23a1fb47e1cfb661a3f308bede8ea4f9c5376d34ecad169a1f28a8a26eee81cc40c84b767415496c477dd4dcfa3
|
data/.github/.typos.toml
ADDED
data/.github/workflows/typos.yml
CHANGED
data/lib/fbe/github_graph.rb
CHANGED
@@ -151,6 +151,87 @@ class Fbe::Graph
|
|
151
151
|
}
|
152
152
|
end
|
153
153
|
|
154
|
+
# Get info about issue type event
|
155
|
+
#
|
156
|
+
# @param [String] node_id ID of the event object
|
157
|
+
# @return [Hash] A hash with issue type event
|
158
|
+
def issue_type_event(node_id)
|
159
|
+
result = query(
|
160
|
+
<<~GRAPHQL
|
161
|
+
{
|
162
|
+
node(id: "#{node_id}") {
|
163
|
+
__typename
|
164
|
+
... on IssueTypeAddedEvent {
|
165
|
+
id
|
166
|
+
createdAt
|
167
|
+
issueType { ...IssueTypeFragment }
|
168
|
+
actor { ...ActorFragment }
|
169
|
+
}
|
170
|
+
... on IssueTypeChangedEvent {
|
171
|
+
id
|
172
|
+
createdAt
|
173
|
+
issueType { ...IssueTypeFragment }
|
174
|
+
prevIssueType { ...IssueTypeFragment }
|
175
|
+
actor { ...ActorFragment }
|
176
|
+
}
|
177
|
+
... on IssueTypeRemovedEvent {
|
178
|
+
id
|
179
|
+
createdAt
|
180
|
+
issueType { ...IssueTypeFragment }
|
181
|
+
actor { ...ActorFragment }
|
182
|
+
}
|
183
|
+
}
|
184
|
+
}
|
185
|
+
fragment ActorFragment on Actor {
|
186
|
+
__typename
|
187
|
+
login
|
188
|
+
... on User { databaseId name email }
|
189
|
+
... on Bot { databaseId }
|
190
|
+
... on EnterpriseUserAccount { user { databaseId name email } }
|
191
|
+
... on Mannequin { claimant { databaseId name email } }
|
192
|
+
}
|
193
|
+
fragment IssueTypeFragment on IssueType {
|
194
|
+
id
|
195
|
+
name
|
196
|
+
description
|
197
|
+
}
|
198
|
+
GRAPHQL
|
199
|
+
).to_h
|
200
|
+
return unless result['node']
|
201
|
+
type = result.dig('node', '__typename')
|
202
|
+
prev_issue_type =
|
203
|
+
if type == 'IssueTypeChangedEvent'
|
204
|
+
{
|
205
|
+
'id' => result.dig('node', 'prevIssueType', 'id'),
|
206
|
+
'name' => result.dig('node', 'prevIssueType', 'name'),
|
207
|
+
'description' => result.dig('node', 'prevIssueType', 'description')
|
208
|
+
}
|
209
|
+
end
|
210
|
+
{
|
211
|
+
'type' => type,
|
212
|
+
'created_at' => Time.parse(result.dig('node', 'createdAt')),
|
213
|
+
'issue_type' => {
|
214
|
+
'id' => result.dig('node', 'issueType', 'id'),
|
215
|
+
'name' => result.dig('node', 'issueType', 'name'),
|
216
|
+
'description' => result.dig('node', 'issueType', 'description')
|
217
|
+
},
|
218
|
+
'prev_issue_type' => prev_issue_type,
|
219
|
+
'actor' => {
|
220
|
+
'login' => result.dig('node', 'actor', 'login'),
|
221
|
+
'type' => result.dig('node', 'actor', '__typename'),
|
222
|
+
'id' => result.dig('node', 'actor', 'databaseId') ||
|
223
|
+
result.dig('node', 'actor', 'user', 'databaseId') ||
|
224
|
+
result.dig('node', 'actor', 'claimant', 'databaseId'),
|
225
|
+
'name' => result.dig('node', 'actor', 'name') ||
|
226
|
+
result.dig('node', 'actor', 'user', 'name') ||
|
227
|
+
result.dig('node', 'actor', 'claimant', 'name'),
|
228
|
+
'email' => result.dig('node', 'actor', 'email') ||
|
229
|
+
result.dig('node', 'actor', 'user', 'email') ||
|
230
|
+
result.dig('node', 'actor', 'claimant', 'email')
|
231
|
+
}
|
232
|
+
}
|
233
|
+
end
|
234
|
+
|
154
235
|
private
|
155
236
|
|
156
237
|
# Creates or returns a cached GraphQL client instance.
|
@@ -216,6 +297,69 @@ class Fbe::Graph
|
|
216
297
|
1484
|
217
298
|
end
|
218
299
|
|
300
|
+
def issue_type_event(node_id)
|
301
|
+
case node_id
|
302
|
+
when 'ITAE_examplevq862Ga8lzwAAAAQZanzv'
|
303
|
+
{
|
304
|
+
'type' => 'IssueTypeAddedEvent',
|
305
|
+
'created_at' => Time.parse('2025-05-11 18:17:16 UTC'),
|
306
|
+
'issue_type' => {
|
307
|
+
'id' => 'IT_exampleQls4BmRE0',
|
308
|
+
'name' => 'Bug',
|
309
|
+
'description' => 'An unexpected problem or behavior'
|
310
|
+
},
|
311
|
+
'prev_issue_type' => nil,
|
312
|
+
'actor' => {
|
313
|
+
'login' => 'yegor256',
|
314
|
+
'type' => 'User',
|
315
|
+
'id' => 526_301,
|
316
|
+
'name' => 'Yegor',
|
317
|
+
'email' => 'example@gmail.com'
|
318
|
+
}
|
319
|
+
}
|
320
|
+
when 'ITCE_examplevq862Ga8lzwAAAAQZbq9S'
|
321
|
+
{
|
322
|
+
'type' => 'IssueTypeChangedEvent',
|
323
|
+
'created_at' => Time.parse('2025-05-11 20:23:13 UTC'),
|
324
|
+
'issue_type' => {
|
325
|
+
'id' => 'IT_kwDODJdQls4BmREz',
|
326
|
+
'name' => 'Task',
|
327
|
+
'description' => 'A specific piece of work'
|
328
|
+
},
|
329
|
+
'prev_issue_type' => {
|
330
|
+
'id' => 'IT_kwDODJdQls4BmRE0',
|
331
|
+
'name' => 'Bug',
|
332
|
+
'description' => 'An unexpected problem or behavior'
|
333
|
+
},
|
334
|
+
'actor' => {
|
335
|
+
'login' => 'yegor256',
|
336
|
+
'type' => 'User',
|
337
|
+
'id' => 526_301,
|
338
|
+
'name' => 'Yegor',
|
339
|
+
'email' => 'example@gmail.com'
|
340
|
+
}
|
341
|
+
}
|
342
|
+
when 'ITRE_examplevq862Ga8lzwAAAAQcqceV'
|
343
|
+
{
|
344
|
+
'type' => 'IssueTypeRemovedEvent',
|
345
|
+
'created_at' => Time.parse('2025-05-11 22:09:42 UTC'),
|
346
|
+
'issue_type' => {
|
347
|
+
'id' => 'IT_kwDODJdQls4BmRE1',
|
348
|
+
'name' => 'Feature',
|
349
|
+
'description' => 'A request, idea, or new functionality'
|
350
|
+
},
|
351
|
+
'prev_issue_type' => nil,
|
352
|
+
'actor' => {
|
353
|
+
'login' => 'yegor256',
|
354
|
+
'type' => 'User',
|
355
|
+
'id' => 526_301,
|
356
|
+
'name' => 'Yegor',
|
357
|
+
'email' => 'example@gmail.com'
|
358
|
+
}
|
359
|
+
}
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
219
363
|
private
|
220
364
|
|
221
365
|
def conversation(id)
|
data/lib/fbe/octo.rb
CHANGED
@@ -832,6 +832,32 @@ class Fbe::FakeOctokit
|
|
832
832
|
name: 'bug'
|
833
833
|
},
|
834
834
|
created_at: random_time
|
835
|
+
},
|
836
|
+
{
|
837
|
+
node_id: 'ITAE_examplevq862Ga8lzwAAAAQZanzv',
|
838
|
+
event: 'issue_type_added',
|
839
|
+
actor: {
|
840
|
+
id: 526_301,
|
841
|
+
login: 'yegor256'
|
842
|
+
},
|
843
|
+
repository: {
|
844
|
+
id: name_to_number('yegor256/judges'),
|
845
|
+
full_name: 'yegor256/judges'
|
846
|
+
},
|
847
|
+
created_at: random_time
|
848
|
+
},
|
849
|
+
{
|
850
|
+
node_id: 'ITCE_examplevq862Ga8lzwAAAAQZbq9S',
|
851
|
+
event: 'issue_type_changed',
|
852
|
+
actor: {
|
853
|
+
id: 526_301,
|
854
|
+
login: 'yegor256'
|
855
|
+
},
|
856
|
+
repository: {
|
857
|
+
id: name_to_number('yegor256/judges'),
|
858
|
+
full_name: 'yegor256/judges'
|
859
|
+
},
|
860
|
+
created_at: random_time
|
835
861
|
}
|
836
862
|
]
|
837
863
|
end
|
data/lib/fbe.rb
CHANGED
@@ -139,4 +139,31 @@ class TestGitHubGraph < Fbe::Test
|
|
139
139
|
graph = Fbe.github_graph(options: Judges::Options.new('testing' => true), loog: Loog::NULL, global: {})
|
140
140
|
assert_equal(1484, graph.total_commits('zerocracy', 'fbe', 'master'))
|
141
141
|
end
|
142
|
+
|
143
|
+
def test_fake_issue_type_event
|
144
|
+
WebMock.disable_net_connect!
|
145
|
+
graph = Fbe.github_graph(options: Judges::Options.new('testing' => true), loog: Loog::NULL, global: {})
|
146
|
+
assert_nil(graph.issue_type_event('wrong_id'))
|
147
|
+
add_type_event = graph.issue_type_event('ITAE_examplevq862Ga8lzwAAAAQZanzv')
|
148
|
+
assert_equal('IssueTypeAddedEvent', add_type_event['type'])
|
149
|
+
assert_equal(Time.parse('2025-05-11 18:17:16 UTC'), add_type_event['created_at'])
|
150
|
+
assert_equal('Bug', add_type_event.dig('issue_type', 'name'))
|
151
|
+
assert_nil(add_type_event['prev_issue_type'])
|
152
|
+
assert_equal(526_301, add_type_event.dig('actor', 'id'))
|
153
|
+
assert_equal('yegor256', add_type_event.dig('actor', 'login'))
|
154
|
+
change_type_event = graph.issue_type_event('ITCE_examplevq862Ga8lzwAAAAQZbq9S')
|
155
|
+
assert_equal('IssueTypeChangedEvent', change_type_event['type'])
|
156
|
+
assert_equal(Time.parse('2025-05-11 20:23:13 UTC'), change_type_event['created_at'])
|
157
|
+
assert_equal('Task', change_type_event.dig('issue_type', 'name'))
|
158
|
+
assert_equal('Bug', change_type_event.dig('prev_issue_type', 'name'))
|
159
|
+
assert_equal(526_301, change_type_event.dig('actor', 'id'))
|
160
|
+
assert_equal('yegor256', change_type_event.dig('actor', 'login'))
|
161
|
+
remove_type_event = graph.issue_type_event('ITRE_examplevq862Ga8lzwAAAAQcqceV')
|
162
|
+
assert_equal('IssueTypeRemovedEvent', remove_type_event['type'])
|
163
|
+
assert_equal(Time.parse('2025-05-11 22:09:42 UTC'), remove_type_event['created_at'])
|
164
|
+
assert_equal('Feature', remove_type_event.dig('issue_type', 'name'))
|
165
|
+
assert_nil(remove_type_event['prev_issue_type'])
|
166
|
+
assert_equal(526_301, remove_type_event.dig('actor', 'id'))
|
167
|
+
assert_equal('yegor256', remove_type_event.dig('actor', 'login'))
|
168
|
+
end
|
142
169
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fbe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
@@ -258,6 +258,7 @@ extra_rdoc_files:
|
|
258
258
|
files:
|
259
259
|
- ".0pdd.yml"
|
260
260
|
- ".gitattributes"
|
261
|
+
- ".github/.typos.toml"
|
261
262
|
- ".github/workflows/actionlint.yml"
|
262
263
|
- ".github/workflows/codecov.yml"
|
263
264
|
- ".github/workflows/copyrights.yml"
|