github_repo_statistics 2.2.7 → 2.2.8

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: 59634e40931b882f4ee361ce7169a527319207e692e4107557456789b7059c7d
4
- data.tar.gz: 5e70e25d137e0eb869c83750f946231d3d6222e5f8bf3aac1e22898035935e1e
3
+ metadata.gz: 9ef7c493b69d48cbb4e65fa99b8daeac622a6a8bcdf2c686a73102ddbdbdbab2
4
+ data.tar.gz: 62bf5ff22b128242b3cf5a2ffeb9bae13bd6b3b16b6026dbabb51e1e7ed9b609
5
5
  SHA512:
6
- metadata.gz: 15904f86e2c96e74e1396c5470ad3ef1698800b110840cc3b8b2d0000914a09984225c92eb3297878b8e4a4ab608d4efa5e134b2f6357ae048606573131f5c17
7
- data.tar.gz: e1cb2e8c6e491e0cc30b55abc67fb39a2ae0be11907b05efe7b92299699317c00db25116a56a2386cb7ab227e8cade36ac71f2e74c52d4b77d66ba597ea864d2
6
+ metadata.gz: 43bb62af4096988880381c52661324e774717a0db51698f063d610bbab9f2988d94ffc4f1ae32e716eeede181923dc06cd0f8afde5a112e41a63c4cbc72850e5
7
+ data.tar.gz: 4cf1461f0388f4c57326999f9864644db68faa2d7a76b88ce2b4e35f00ee9991d4114ad67270aba6210e4b3b3c5a0fd2adf1977c201730642bd5d84f170bb051
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- github_repo_statistics (2.2.6)
4
+ github_repo_statistics (2.2.7)
5
5
  date
6
6
  faraday-retry
7
7
  google-cloud-bigquery
@@ -22,6 +22,10 @@ class ForceMergeReport
22
22
  # Sort PRs into monthly chunks
23
23
  weekly_pull_requests = pull_requests.group_by { |pr| pr.closed_at.strftime('%Y-%W') }
24
24
 
25
+ if weekly_pull_requests[Time.now.strftime('%Y-%W')].nil?
26
+ weekly_pull_requests[Time.now.strftime('%Y-%W')] = []
27
+ end
28
+
25
29
  # Initialize a hash to store monthly summaries
26
30
  weekly_summaries = Hash.new { |hash, key| hash[key] = { total: 0, failed: 0, workflows: Hash.new(0) } }
27
31
 
@@ -50,7 +54,7 @@ class ForceMergeReport
50
54
  failed_checks = all_checks.reject { |check| check.conclusion == 'success' || check.state == 'success' }
51
55
 
52
56
  failed_checks.select! do |check|
53
- ['Mergeable: Size check', 'SonarQube Code Analysis', 'UI Tests'].include?(check.name)
57
+ ['Mergeable: Size check', 'SonarQube Code Analysis', 'UI Tests', 'Unit Tests'].include?(check.name)
54
58
  end
55
59
 
56
60
  # Update monthly summary
@@ -86,6 +90,7 @@ class ForceMergeReport
86
90
  summary[:workflows].each do |workflow, count|
87
91
  puts " - #{workflow}: #{count}"
88
92
  end
93
+
89
94
  if ENV['BQ_CREDENTIALS']
90
95
  require "google/cloud/bigquery"
91
96
  require "json"
@@ -97,15 +102,25 @@ class ForceMergeReport
97
102
  dataset = bigquery.dataset "github_data"
98
103
 
99
104
  failed_count = summary[:failed]
105
+ size_check = summary[:workflows]["Mergeable: Size check"]
106
+ sonarqube_check = summary[:workflows]['SonarQube Code Analysis']
107
+ ui_tests_check = summary[:workflows]['UI Tests']
108
+ unit_tests_check = summary[:workflows]['Unit Tests']
100
109
 
101
110
  query = <<~SQL
102
111
  MERGE INTO force_merges AS target
103
112
  USING (SELECT '#{week}' AS calendar_week) AS source
104
113
  ON target.calendar_week = source.calendar_week
105
114
  WHEN MATCHED THEN
106
- UPDATE SET target.force_merges_count = #{failed_count}
115
+ UPDATE SET
116
+ target.force_merges_count = #{failed_count},
117
+ target.ui_tests_count = #{ui_tests_check},
118
+ target.unit_tests_count = #{unit_tests_check},
119
+ target.size_check_count = #{size_check},
120
+ target.sonarqube_count = #{sonarqube_check}
107
121
  WHEN NOT MATCHED THEN
108
- INSERT (calendar_week, force_merges_count) VALUES ('#{week}', #{failed_count});
122
+ INSERT (calendar_week, force_merges_count, ui_tests_count, unit_tests_count, size_check_count, sonarqube_count)
123
+ VALUES ('#{week}', #{failed_count}, #{ui_tests_check}, #{unit_tests_check}, #{size_check}, #{sonarqube_check});
109
124
  SQL
110
125
 
111
126
  dataset.query(query)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GithubRepoStatistics
4
- VERSION = '2.2.7'
4
+ VERSION = '2.2.8'
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.2.7
4
+ version: 2.2.8
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-29 00:00:00.000000000 Z
11
+ date: 2024-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: date