github_repo_statistics 2.1.0 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7625d04f395885b90b8f2faad896127df5e16604818d095f3e5455bf49d9c899
4
- data.tar.gz: e6fec8b96326f6aff20e8ba63ccde41d3605381a692df51a3e7dceac8f0b218c
3
+ metadata.gz: 32a32c6f62a480cf221be8bff5cbfcf71d7c83ca003c89c287c738dc55c7fad4
4
+ data.tar.gz: 9debc63a18ca6a43a57dc2d20b23de8faaa5b7379acdafd54c3441baa860e1c2
5
5
  SHA512:
6
- metadata.gz: c943a3541d786ca121518c4545a0d82f036d71492ad83bec46ffffd187e4f6536475688acd1f3841e20ded27b29eb4759675e40ef86d55a66ef2ae147487e8fe
7
- data.tar.gz: 76c00e2a9cc37a21026cb31229f6c7c71733428b1fc1d06fd24f5c8e9d5c8777d85d23e45c4af73ddaf699d6c8afd63dab38dc40af2780c0f73f704e32b0b4b2
6
+ metadata.gz: 3d9cebec47d922b097adfef784253a3b69e502a4851b6c632e0bdb776946baf87d454c2105c41fbee2ccf4792e8e665bfdc718d2c8a096545bfcbe1845bb030b
7
+ data.tar.gz: bac34a152ea3d91c7a799f70362cdafa3c1de969c3c840853eb557f59ddf64cf6b2e857888e900c764f9077021574f7a2982e27a8ec89fe58aaa3f20d483b6c4
data/Gemfile.lock CHANGED
@@ -4,6 +4,7 @@ PATH
4
4
  github_repo_statistics (2.1.0)
5
5
  date
6
6
  faraday-retry
7
+ google-cloud-bigquery
7
8
  octokit
8
9
  pry
9
10
 
@@ -13,8 +14,11 @@ GEM
13
14
  addressable (2.8.4)
14
15
  public_suffix (>= 2.0.2, < 6.0)
15
16
  ast (2.4.2)
17
+ base64 (0.2.0)
16
18
  coderay (1.1.3)
19
+ concurrent-ruby (1.2.3)
17
20
  date (3.3.4)
21
+ declarative (0.0.20)
18
22
  diff-lcs (1.5.0)
19
23
  faraday (2.7.9)
20
24
  faraday-net_http (>= 2.0, < 3.1)
@@ -22,12 +26,48 @@ GEM
22
26
  faraday-net_http (3.0.2)
23
27
  faraday-retry (2.2.0)
24
28
  faraday (~> 2.0)
29
+ google-apis-bigquery_v2 (0.65.0)
30
+ google-apis-core (>= 0.14.0, < 2.a)
31
+ google-apis-core (0.14.0)
32
+ addressable (~> 2.5, >= 2.5.1)
33
+ googleauth (~> 1.9)
34
+ httpclient (>= 2.8.1, < 3.a)
35
+ mini_mime (~> 1.0)
36
+ representable (~> 3.0)
37
+ retriable (>= 2.0, < 4.a)
38
+ rexml
39
+ google-cloud-bigquery (1.48.1)
40
+ concurrent-ruby (~> 1.0)
41
+ google-apis-bigquery_v2 (~> 0.62)
42
+ google-apis-core (~> 0.13)
43
+ google-cloud-core (~> 1.6)
44
+ googleauth (~> 1.9)
45
+ mini_mime (~> 1.0)
46
+ google-cloud-core (1.6.1)
47
+ google-cloud-env (>= 1.0, < 3.a)
48
+ google-cloud-errors (~> 1.0)
49
+ google-cloud-env (2.1.1)
50
+ faraday (>= 1.0, < 3.a)
51
+ google-cloud-errors (1.3.1)
52
+ googleauth (1.11.0)
53
+ faraday (>= 1.0, < 3.a)
54
+ google-cloud-env (~> 2.1)
55
+ jwt (>= 1.4, < 3.0)
56
+ multi_json (~> 1.11)
57
+ os (>= 0.9, < 2.0)
58
+ signet (>= 0.16, < 2.a)
59
+ httpclient (2.8.3)
25
60
  json (2.7.1)
61
+ jwt (2.8.0)
62
+ base64
26
63
  language_server-protocol (3.17.0.3)
27
64
  method_source (1.0.0)
65
+ mini_mime (1.1.5)
66
+ multi_json (1.15.0)
28
67
  octokit (8.0.0)
29
68
  faraday (>= 1, < 3)
30
69
  sawyer (~> 0.9)
70
+ os (1.1.4)
31
71
  parallel (1.24.0)
32
72
  parser (3.3.0.4)
33
73
  ast (~> 2.4.1)
@@ -40,6 +80,11 @@ GEM
40
80
  rainbow (3.1.1)
41
81
  rake (13.1.0)
42
82
  regexp_parser (2.9.0)
83
+ representable (3.2.0)
84
+ declarative (< 0.1.0)
85
+ trailblazer-option (>= 0.1.1, < 0.2.0)
86
+ uber (< 0.2.0)
87
+ retriable (3.1.2)
43
88
  rexml (3.2.6)
44
89
  rspec (3.12.0)
45
90
  rspec-core (~> 3.12.0)
@@ -72,6 +117,13 @@ GEM
72
117
  sawyer (0.9.2)
73
118
  addressable (>= 2.3.5)
74
119
  faraday (>= 0.17.3, < 3)
120
+ signet (0.19.0)
121
+ addressable (~> 2.8)
122
+ faraday (>= 0.17.5, < 3.a)
123
+ jwt (>= 1.5, < 3.0)
124
+ multi_json (~> 1.10)
125
+ trailblazer-option (0.1.2)
126
+ uber (0.1.0)
75
127
  unicode-display_width (2.5.0)
76
128
 
77
129
  PLATFORMS
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency 'octokit'
29
29
  spec.add_dependency 'pry'
30
30
  spec.add_dependency 'faraday-retry'
31
+ spec.add_dependency 'google-cloud-bigquery'
31
32
  end
@@ -76,12 +76,37 @@ class ForceMergeReport
76
76
 
77
77
  # Print the weekly summary
78
78
  puts 'Weekly Summary:'
79
- weekly_summaries.each do |month, summary|
80
- puts "Calendar week #{month}: Total PRs: #{summary[:total]}, Force-merged PRs: #{summary[:failed]}"
79
+ weekly_summaries.each do |week, summary|
80
+ puts "Calendar week #{week}: Total PRs: #{summary[:total]}, Force-merged PRs: #{summary[:failed]}"
81
81
  puts 'Failed Workflows:'
82
82
  summary[:workflows].each do |workflow, count|
83
83
  puts " - #{workflow}: #{count}"
84
84
  end
85
+ if ENV['BQ_CREDENTIALS']
86
+ require "google/cloud/bigquery"
87
+ require "json"
88
+ require 'pry'
89
+ binding.pry
90
+ bigquery = Google::Cloud::Bigquery.new(
91
+ project_id: "hellofresh-android",
92
+ credentials: JSON.parse(ENV['BQ_CREDENTIALS'])
93
+ )
94
+ dataset = bigquery.dataset "github_data"
95
+
96
+ failed_count = summary[:failed]
97
+
98
+ query = <<~SQL
99
+ MERGE INTO force_merges AS target
100
+ USING (SELECT '#{week}' AS calendar_week) AS source
101
+ ON target.calendar_week = source.calendar_week
102
+ WHEN MATCHED THEN
103
+ UPDATE SET target.force_merges_count = #{failed_count}
104
+ WHEN NOT MATCHED THEN
105
+ INSERT (calendar_week, force_merges_count) VALUES ('#{week}', #{failed_count});
106
+ SQL
107
+
108
+ dataset.query(query)
109
+ end
85
110
  end
86
111
  end
87
112
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GithubRepoStatistics
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_repo_statistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serghei Moret
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-27 00:00:00.000000000 Z
11
+ date: 2024-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: date
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: google-cloud-bigquery
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description:
70
84
  email:
71
85
  - serghei.moret@hellofresh.com