snitch-rails 0.4.2 → 0.4.3
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/lib/generators/snitch/install/templates/create_snitch_errors.rb.erb +1 -0
- data/lib/generators/snitch/update/templates/add_github_comment_id_to_snitch_errors.rb.erb +5 -0
- data/lib/generators/snitch/update/update_generator.rb +2 -2
- data/lib/snitch/github_client.rb +9 -12
- data/lib/snitch/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5ab64d6178cc4cb1867bef64be6d04cf5ff5fd67acf8f818d9e275f131aa3298
|
|
4
|
+
data.tar.gz: 4dffc580d28c3415a37760c0b1116445d23544cf58a966a317879c387a8c7e5a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69df4c6e51b7e427f2ec7461d0ccfe320677c564148449aa26dac870371142b039db4bc097fd6d446a3bab53eb6ac35b5f70f9d2a4ec95b5281df88249f2e786
|
|
7
|
+
data.tar.gz: e9f2f55ec5c5997d9767188b41d442b38eb8105dc81e3cbe132beb275090ba467c3066711450f099b444b2ef93444474bc4522894fadb42993b184016bbf1267
|
|
@@ -11,6 +11,7 @@ class CreateSnitchErrors < ActiveRecord::Migration[<%= ActiveRecord::Migration.c
|
|
|
11
11
|
t.integer :occurrence_count, default: 1
|
|
12
12
|
t.integer :github_issue_number
|
|
13
13
|
t.string :github_issue_url
|
|
14
|
+
t.integer :github_comment_id
|
|
14
15
|
t.string :status, default: "open", null: false
|
|
15
16
|
t.datetime :first_occurred_at
|
|
16
17
|
t.datetime :last_occurred_at
|
|
@@ -9,8 +9,8 @@ module Snitch
|
|
|
9
9
|
source_root File.expand_path("templates", __dir__)
|
|
10
10
|
|
|
11
11
|
def create_migration_file
|
|
12
|
-
migration_template "
|
|
13
|
-
"db/migrate/
|
|
12
|
+
migration_template "add_github_comment_id_to_snitch_errors.rb.erb",
|
|
13
|
+
"db/migrate/add_github_comment_id_to_snitch_errors.rb"
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
end
|
data/lib/snitch/github_client.rb
CHANGED
|
@@ -23,7 +23,14 @@ module Snitch
|
|
|
23
23
|
|
|
24
24
|
def comment_on_issue(event)
|
|
25
25
|
body = build_comment_body(event)
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
if event.github_comment_id.present?
|
|
28
|
+
@client.update_comment(@repo, event.github_comment_id, body)
|
|
29
|
+
else
|
|
30
|
+
comment = @client.add_comment(@repo, event.github_issue_number, body)
|
|
31
|
+
event.update!(github_comment_id: comment.id)
|
|
32
|
+
end
|
|
33
|
+
|
|
27
34
|
reopen_issue(event) if event.status == "open"
|
|
28
35
|
end
|
|
29
36
|
|
|
@@ -62,18 +69,8 @@ module Snitch
|
|
|
62
69
|
end
|
|
63
70
|
|
|
64
71
|
def build_comment_body(record)
|
|
65
|
-
mention = Snitch.configuration.mention
|
|
66
72
|
<<~MARKDOWN
|
|
67
|
-
|
|
68
|
-
**Total occurrences:** #{record.occurrence_count}
|
|
69
|
-
**Latest occurrence:** #{record.last_occurred_at&.utc}
|
|
70
|
-
|
|
71
|
-
## Latest Request Context
|
|
72
|
-
- **URL:** #{record.request_method} #{record.request_url}
|
|
73
|
-
- **Params:** `#{record.request_params}`
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
#{mention} This exception has occurred again. Please review if the previous analysis still applies, fix the issue, and open a pull request with your changes.
|
|
73
|
+
**Occurrences:** #{record.occurrence_count} | **Latest:** #{record.last_occurred_at&.utc}
|
|
77
74
|
MARKDOWN
|
|
78
75
|
end
|
|
79
76
|
|
data/lib/snitch/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: snitch-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RiseKit
|
|
@@ -140,6 +140,7 @@ files:
|
|
|
140
140
|
- lib/generators/snitch/install/install_generator.rb
|
|
141
141
|
- lib/generators/snitch/install/templates/create_snitch_errors.rb.erb
|
|
142
142
|
- lib/generators/snitch/install/templates/snitch.rb
|
|
143
|
+
- lib/generators/snitch/update/templates/add_github_comment_id_to_snitch_errors.rb.erb
|
|
143
144
|
- lib/generators/snitch/update/templates/add_status_to_snitch_errors.rb.erb
|
|
144
145
|
- lib/generators/snitch/update/update_generator.rb
|
|
145
146
|
- lib/snitch.rb
|