fbe 0.46.0 → 0.48.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/workflows/codecov.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/fbe/github_graph.rb +80 -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: 538f8ba632b6f0b3990005e4b685dd6ae566cd6c7716f873ffffce71374762f6
|
|
4
|
+
data.tar.gz: a6caf3ed9674d00f32bb63663d654bb32f98f2c958ca9002cb707f5c778705eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3897f73ce91ee6ccb0e41d9831f4fb812ed305d1a79e35bde091cc58d209718fb660a5a6cd0175365d1b3c77ff75b74f3fd04fb7865fd636fc7b886688527fbb
|
|
7
|
+
data.tar.gz: f0c988a409b17630d786b79a17b5e02204c42693e419861948502db001d959eedd90101c80faf5131d5475ed9aee85376923cb8a89f00d40643331f42576d613
|
data/Gemfile.lock
CHANGED
data/lib/fbe/github_graph.rb
CHANGED
|
@@ -431,6 +431,75 @@ class Fbe::Graph
|
|
|
431
431
|
}
|
|
432
432
|
end
|
|
433
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
|
+
|
|
465
|
+
# Get total count releases from the specified date
|
|
466
|
+
#
|
|
467
|
+
# @param [String] owner The repository owner (username or organization)
|
|
468
|
+
# @param [String] name The repository name
|
|
469
|
+
# @param [Time] since The datetime from
|
|
470
|
+
# @return [Hash] A hash with total releases
|
|
471
|
+
def total_releases_published(owner, name, since)
|
|
472
|
+
total = 0
|
|
473
|
+
cursor = nil
|
|
474
|
+
loop do
|
|
475
|
+
result = query(
|
|
476
|
+
<<~GRAPHQL
|
|
477
|
+
{
|
|
478
|
+
repository(owner: "#{owner}", name: "#{name}") {
|
|
479
|
+
releases(first: 25, after: "#{cursor}", orderBy: { field: CREATED_AT, direction: DESC }) {
|
|
480
|
+
nodes {
|
|
481
|
+
isDraft
|
|
482
|
+
publishedAt
|
|
483
|
+
}
|
|
484
|
+
pageInfo {
|
|
485
|
+
endCursor
|
|
486
|
+
hasNextPage
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
GRAPHQL
|
|
492
|
+
).to_h
|
|
493
|
+
releases = result.dig('repository', 'releases', 'nodes')
|
|
494
|
+
break if releases.nil? || releases.empty?
|
|
495
|
+
total += releases.count { !_1['isDraft'] && _1['publishedAt'] && Time.parse(_1['publishedAt']) > since }
|
|
496
|
+
break if releases.all? { _1['publishedAt'] && Time.parse(_1['publishedAt']) < since }
|
|
497
|
+
break unless result.dig('repository', 'releases', 'pageInfo', 'hasNextPage')
|
|
498
|
+
cursor = result.dig('repository', 'releases', 'pageInfo', 'endCursor')
|
|
499
|
+
end
|
|
500
|
+
{ 'releases' => total }
|
|
501
|
+
end
|
|
502
|
+
|
|
434
503
|
private
|
|
435
504
|
|
|
436
505
|
# Creates or returns a cached GraphQL client instance.
|
|
@@ -666,6 +735,17 @@ class Fbe::Graph
|
|
|
666
735
|
}
|
|
667
736
|
end
|
|
668
737
|
|
|
738
|
+
def total_issues_created(_owner, _name, _since)
|
|
739
|
+
{
|
|
740
|
+
'issues' => 17,
|
|
741
|
+
'pulls' => 8
|
|
742
|
+
}
|
|
743
|
+
end
|
|
744
|
+
|
|
745
|
+
def total_releases_published(_owner, _name, _since)
|
|
746
|
+
{ 'releases' => 7 }
|
|
747
|
+
end
|
|
748
|
+
|
|
669
749
|
private
|
|
670
750
|
|
|
671
751
|
# 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