fbe 0.45.0 → 0.47.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/Gemfile.lock +1 -1
- data/lib/fbe/github_graph.rb +87 -0
- data/lib/fbe/iterate.rb +1 -1
- data/lib/fbe.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea72dd302f243abc5aaa0da86d414580675387042d714f1a60fa9addfe8e9a70
|
|
4
|
+
data.tar.gz: '09633905c14bfb956572d30a2a831be6df7fc56c8f95232a6a7cb8637b18b8be'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b24e9117c568b82350034ea63188091a1fe5f82a8c4db26c6af3fe20626023f67c7317bf736bf434b13f0ae64d9cb2154561a4a7d7a212f99c48aa2cf3b0f8c9
|
|
7
|
+
data.tar.gz: 53699c7aac11b4e18bd45d9946c847dd79b0ae6c63509b1d58eb9baf6a61449480da94e30f83a7df5f079cd70b781cb0b97d59b40a6a96a07031e9008ba8cbdd
|
data/Gemfile.lock
CHANGED
data/lib/fbe/github_graph.rb
CHANGED
|
@@ -389,6 +389,79 @@ class Fbe::Graph
|
|
|
389
389
|
end
|
|
390
390
|
end
|
|
391
391
|
|
|
392
|
+
# Get total commits pushed to default branch
|
|
393
|
+
#
|
|
394
|
+
# @param [String] owner The repository owner (username or organization)
|
|
395
|
+
# @param [String] name The repository name
|
|
396
|
+
# @param [Time] since The datetime from
|
|
397
|
+
# @return [Hash] A hash with total commits and hocs
|
|
398
|
+
def total_commits_pushed(owner, name, since)
|
|
399
|
+
# @todo #1223:60min Missing pagination could cause performance issues or API failures. You need add
|
|
400
|
+
# pagination for commit history, for more info see
|
|
401
|
+
# https://github.com/zerocracy/fbe/pull/366#discussion_r2610751758
|
|
402
|
+
result = query(
|
|
403
|
+
<<~GRAPHQL
|
|
404
|
+
{
|
|
405
|
+
repository(owner: "#{owner}", name: "#{name}") {
|
|
406
|
+
defaultBranchRef {
|
|
407
|
+
target {
|
|
408
|
+
... on Commit {
|
|
409
|
+
history(since: "#{since.utc.iso8601}") {
|
|
410
|
+
totalCount
|
|
411
|
+
nodes {
|
|
412
|
+
oid
|
|
413
|
+
parents {
|
|
414
|
+
totalCount
|
|
415
|
+
}
|
|
416
|
+
additions
|
|
417
|
+
deletions
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
GRAPHQL
|
|
426
|
+
).to_h
|
|
427
|
+
commits = result.dig('repository', 'defaultBranchRef', 'target', 'history', 'nodes')
|
|
428
|
+
{
|
|
429
|
+
'commits' => result.dig('repository', 'defaultBranchRef', 'target', 'history', 'totalCount') || 0,
|
|
430
|
+
'hoc' => commits.nil? ? 0 : commits.sum { (_1['additions'] || 0) + (_1['deletions'] || 0) }
|
|
431
|
+
}
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
# Get total count issues and pulls created from the specified date
|
|
435
|
+
#
|
|
436
|
+
# @param [String] owner The repository owner (username or organization)
|
|
437
|
+
# @param [String] name The repository name
|
|
438
|
+
# @param [Time] since The datetime from
|
|
439
|
+
# @return [Hash] A hash with total issues and pulls
|
|
440
|
+
def total_issues_created(owner, name, since)
|
|
441
|
+
result = query(
|
|
442
|
+
<<~GRAPHQL
|
|
443
|
+
{
|
|
444
|
+
issues: search(
|
|
445
|
+
query: "repo:#{owner}/#{name} type:issue created:>#{since.utc.iso8601}",
|
|
446
|
+
type: ISSUE
|
|
447
|
+
) {
|
|
448
|
+
issueCount
|
|
449
|
+
},
|
|
450
|
+
pulls: search(
|
|
451
|
+
query: "repo:#{owner}/#{name} type:pr created:>#{since.utc.iso8601}",
|
|
452
|
+
type: ISSUE
|
|
453
|
+
) {
|
|
454
|
+
issueCount
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
GRAPHQL
|
|
458
|
+
).to_h
|
|
459
|
+
{
|
|
460
|
+
'issues' => result.dig('issues', 'issueCount') || 0,
|
|
461
|
+
'pulls' => result.dig('pulls', 'issueCount') || 0
|
|
462
|
+
}
|
|
463
|
+
end
|
|
464
|
+
|
|
392
465
|
private
|
|
393
466
|
|
|
394
467
|
# Creates or returns a cached GraphQL client instance.
|
|
@@ -617,6 +690,20 @@ class Fbe::Graph
|
|
|
617
690
|
]
|
|
618
691
|
end
|
|
619
692
|
|
|
693
|
+
def total_commits_pushed(_owner, _name, _since)
|
|
694
|
+
{
|
|
695
|
+
'commits' => 29,
|
|
696
|
+
'hoc' => 1857
|
|
697
|
+
}
|
|
698
|
+
end
|
|
699
|
+
|
|
700
|
+
def total_issues_created(_owner, _name, _since)
|
|
701
|
+
{
|
|
702
|
+
'issues' => 17,
|
|
703
|
+
'pulls' => 8
|
|
704
|
+
}
|
|
705
|
+
end
|
|
706
|
+
|
|
620
707
|
private
|
|
621
708
|
|
|
622
709
|
# Generates mock conversation thread data.
|
data/lib/fbe/iterate.rb
CHANGED
|
@@ -334,7 +334,7 @@ class Fbe::Iterate
|
|
|
334
334
|
defined?(before) && !before.nil? &&
|
|
335
335
|
defined?(starts) && !starts.nil?
|
|
336
336
|
repos.each do |repo|
|
|
337
|
-
next if before[repo] == starts[repo]
|
|
337
|
+
next if before[repo] == starts[repo] || before[repo] == @since
|
|
338
338
|
f =
|
|
339
339
|
Fbe.if_absent(fb: @fb, always: true) do |n|
|
|
340
340
|
n.what = 'iterate'
|
data/lib/fbe.rb
CHANGED