github_repo_statistics 2.2.7 → 2.2.9
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/github_repo_statistics/force_merge_report.rb +19 -4
- data/lib/github_repo_statistics/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f245b6049e774db333ca34b3adca5a17f88e4f3af89cbca24b51f4cbb348698b
|
4
|
+
data.tar.gz: 54f0ff2e46b91d01a37f0f37a753d3e142f45d4e1453b582e0fb06afafa96648
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c8744737e5f77bb61cc94d377f27f0b3441b55ca675810524fad0627f8580197ab4184d3b7539db448fef19dbcd22219b3bb9f253e2437418a706c2a8ef576b
|
7
|
+
data.tar.gz: 5b3a2cfc158deaf6a867324851fab66f04ccb0bfbb4be6499bc375d1708fb37bc0c5c3979010e0ba953d28c2272729e1a254d6859f22d7765724fea884d249cf
|
data/Gemfile.lock
CHANGED
@@ -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
|
|
@@ -48,9 +52,9 @@ class ForceMergeReport
|
|
48
52
|
|
49
53
|
# Filter checks without meeting the required status checks
|
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'
|
57
|
+
['UI Tests', 'Unit Tests'].include?(check.context) || ['Mergeable: Size check', 'SonarQube Code Analysis'].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
|
+
ENV['BQ_CREDENTIALS'] = `cat /Users/serghei.moret/.config/gcloud/application_default_credentials.json`
|
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
|
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
|
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)
|
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.
|
4
|
+
version: 2.2.9
|
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-
|
11
|
+
date: 2024-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: date
|