@@ -33,12 +33,13 @@ def self.fetch_tag(fact, repo)
33
33
tag = Fbe . octo . release (
34
34
"https://api.github.com/repos/#{ repo } /releases/#{ fact . release_id } "
35
35
) . fetch ( :tag_name , nil )
36
+ $loog. debug ( "The release ##{ fact . release_id } has this tag: #{ tag . inspect } " )
36
37
end
37
38
tag
38
39
end
39
40
40
41
def self . fetch_contributors ( fact , repo )
41
- last = Fbe . fb . query ( "(and (eq repository #{ fact . repository } ) (eq what \" #{ fact . what } \" ))" ) . each . last
42
+ last = Fbe . fb . query ( "(and (eq repository #{ fact . repository } ) (eq what \" #{ fact . what } \" ))" ) . each . to_a . last
42
43
tag = fetch_tag ( last , repo )
43
44
contributors = Set . new
44
45
if tag
@@ -51,11 +52,12 @@ def self.fetch_contributors(fact, repo)
51
52
contributors << contributor [ :id ]
52
53
end
53
54
end
55
+ $loog. debug ( "The repository ##{ fact . repository } has #{ contributors . count } contributors" )
54
56
contributors . to_a
55
57
end
56
58
57
59
def self . fetch_release_info ( fact , repo )
58
- last = Fbe . fb . query ( "(and (eq repository #{ fact . repository } ) (eq what \" #{ fact . what } \" ))" ) . each . last
60
+ last = Fbe . fb . query ( "(and (eq repository #{ fact . repository } ) (eq what \" #{ fact . what } \" ))" ) . each . to_a . last
59
61
tag = fetch_tag ( last , repo )
60
62
tag ||= find_first_commit ( repo ) [ :sha ]
61
63
info = { }
@@ -64,6 +66,7 @@ def self.fetch_release_info(fact, repo)
64
66
info [ :hoc ] = json [ :files ] . sum { |f | f [ :changes ] }
65
67
info [ :last_commit ] = json [ :commits ] . first [ :sha ]
66
68
end
69
+ $loog. debug ( "The repository ##{ fact . repository } has this: #{ info . inspect } " )
67
70
info
68
71
end
69
72
@@ -74,6 +77,7 @@ def self.find_first_commit(repo)
74
77
commits = Fbe . octo . commits ( repo , sha : last [ :sha ] )
75
78
last = commits . last
76
79
end
80
+ $loog. debug ( "The repo ##{ repo } has this last commit: #{ last } " )
77
81
last
78
82
end
79
83
@@ -172,6 +176,7 @@ def self.fill_up_event(fact, json)
172
176
"A new Git push ##{ json [ :payload ] [ :push_id ] } has arrived to #{ rname } , " \
173
177
"made by #{ Fbe . who ( fact ) } (default branch is '#{ fact . default_branch } '), " \
174
178
'not associated with any pull request.'
179
+ $loog. debug ( "New PushEvent ##{ json [ :payload ] [ :push_id ] } recorded" )
175
180
176
181
when 'PullRequestEvent'
177
182
pl = json [ :payload ] [ :pull_request ]
@@ -181,6 +186,7 @@ def self.fill_up_event(fact, json)
181
186
fact . what = 'pull-was-opened'
182
187
fact . branch = pl [ :head ] [ :ref ]
183
188
fact . details = "The pull request #{ Fbe . issue ( fact ) } has been opened by #{ Fbe . who ( fact ) } ."
189
+ $loog. debug ( "New PR #{ Fbe . issue ( fact ) } opened by #{ Fbe . who ( fact ) } " )
184
190
when 'closed'
185
191
fact . what = "pull-was-#{ pl [ :merged_at ] . nil? ? 'closed' : 'merged' } "
186
192
fact . hoc = pl [ :additions ] + pl [ :deletions ]
@@ -191,6 +197,7 @@ def self.fill_up_event(fact, json)
191
197
"The pull request #{ Fbe . issue ( fact ) } " \
192
198
"has been #{ json [ :payload ] [ :action ] } by #{ Fbe . who ( fact ) } , " \
193
199
"with #{ fact . hoc } HoC and #{ fact . comments } comments."
200
+ $loog. debug ( "PR #{ Fbe . issue ( fact ) } closed by #{ Fbe . who ( fact ) } " )
194
201
else
195
202
skip_event ( json )
196
203
end
@@ -204,7 +211,7 @@ def self.fill_up_event(fact, json)
204
211
'(eq what "pull-was-reviewed") ' \
205
212
"(eq who #{ fact . who } ) " \
206
213
"(eq issue #{ json [ :payload ] [ :pull_request ] [ :number ] } ))"
207
- ) . each . last
214
+ ) . each . to_a . last
208
215
skip_event ( json )
209
216
end
210
217
skip_event ( json ) unless json [ :payload ] [ :review ] [ :state ] == 'approved'
@@ -220,6 +227,7 @@ def self.fill_up_event(fact, json)
220
227
"The pull request #{ Fbe . issue ( fact ) } " \
221
228
"has been reviewed by #{ Fbe . who ( fact ) } " \
222
229
"with #{ fact . hoc } HoC and #{ fact . comments } comments."
230
+ $loog. debug ( "PR #{ Fbe . issue ( fact ) } was reviewed by #{ Fbe . who ( fact ) } " )
223
231
else
224
232
skip_event ( json )
225
233
end
@@ -230,9 +238,11 @@ def self.fill_up_event(fact, json)
230
238
when 'closed'
231
239
fact . what = 'issue-was-closed'
232
240
fact . details = "The issue #{ Fbe . issue ( fact ) } has been closed by #{ Fbe . who ( fact ) } ."
241
+ $loog. debug ( "Issue #{ Fbe . issue ( fact ) } closed by #{ Fbe . who ( fact ) } " )
233
242
when 'opened'
234
243
fact . what = 'issue-was-opened'
235
244
fact . details = "The issue #{ Fbe . issue ( fact ) } has been opened by #{ Fbe . who ( fact ) } ."
245
+ $loog. debug ( "Issue #{ Fbe . issue ( fact ) } opened by #{ Fbe . who ( fact ) } " )
236
246
else
237
247
skip_event ( json )
238
248
end
@@ -249,6 +259,7 @@ def self.fill_up_event(fact, json)
249
259
fact . details =
250
260
"A new comment ##{ json [ :payload ] [ :comment ] [ :id ] } has been posted " \
251
261
"to #{ Fbe . issue ( fact ) } by #{ Fbe . who ( fact ) } ."
262
+ $loog. debug ( "Issue comment posted to #{ Fbe . issue ( fact ) } by #{ Fbe . who ( fact ) } " )
252
263
end
253
264
skip_event ( json )
254
265
@@ -264,6 +275,7 @@ def self.fill_up_event(fact, json)
264
275
fact . details =
265
276
"A new release '#{ json [ :payload ] [ :release ] [ :name ] } ' has been published " \
266
277
"in #{ rname } by #{ Fbe . who ( fact ) } ."
278
+ $loog. debug ( "Release published by #{ Fbe . who ( fact ) } " )
267
279
else
268
280
skip_event ( json )
269
281
end
@@ -276,6 +288,7 @@ def self.fill_up_event(fact, json)
276
288
fact . details =
277
289
"A new tag '#{ fact . tag } ' has been created " \
278
290
"in #{ rname } by #{ Fbe . who ( fact ) } ."
291
+ $loog. debug ( "Tag #{ fact . tag . inspect } created by #{ Fbe . who ( fact ) } " )
279
292
else
280
293
skip_event ( json )
281
294
end
1 commit comments
0crat commentedon Mar 20, 2025
@yegor256 It is not a good idea to push directly to the default branch
master
. You've earned -16 points. Next time, create a new branch, push your changes over there, then make a pull request and merge it. Even if you are flying solo, contributing via pull requests is a good practice.