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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4a9942846e182eb704d4c4e10b4e80194e6ea3f59e5378ea0f84d23b5fe08d2
4
- data.tar.gz: 5932c9d1a334dea60cec053f49b53d686fe0cd00f4e2ba08c76b88b5d8405f8e
3
+ metadata.gz: 5ab64d6178cc4cb1867bef64be6d04cf5ff5fd67acf8f818d9e275f131aa3298
4
+ data.tar.gz: 4dffc580d28c3415a37760c0b1116445d23544cf58a966a317879c387a8c7e5a
5
5
  SHA512:
6
- metadata.gz: 50128e3c306cf996c995151f70853691738804112308e27cf6d1235f5e3571492cb44d6aab28b1eb6f4ffe81d9ac4ac2d9396e4574833937e9ce2c83f2ab981c
7
- data.tar.gz: 3f8bebecc5dd347cc55655abb50f2f311961bb03bda4c3fcb24d034835f3a9d5ae30fabe66704f636d81e6f9cca97e5a9a96a04373326a47b8d5dc43a9a44372
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
@@ -0,0 +1,5 @@
1
+ class AddGithubCommentIdToSnitchErrors < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
+ def change
3
+ add_column :snitch_errors, :github_comment_id, :integer
4
+ end
5
+ end
@@ -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 "add_status_to_snitch_errors.rb.erb",
13
- "db/migrate/add_status_to_snitch_errors.rb"
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
@@ -23,7 +23,14 @@ module Snitch
23
23
 
24
24
  def comment_on_issue(event)
25
25
  body = build_comment_body(event)
26
- @client.add_comment(@repo, event.github_issue_number, body)
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
- ## New Occurrence
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Snitch
4
- VERSION = '0.4.2'
4
+ VERSION = '0.4.3'
5
5
  end
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.2
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