browser_review_gate 0.5.2 → 0.5.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: 294c10fc153a1a94639ddca7782e91c71571251286996f68f5134c2c3715ac82
4
- data.tar.gz: 8f28eef0a92edbb82eb30177227ed453ac036013844f850ffe2909ec78921acb
3
+ metadata.gz: fa41c3531805de8375cd86b4251457ed78e065eec4ca8e5a02f6adb2196d6dc2
4
+ data.tar.gz: d8459a362a7b71375a0c2d9ea12e7fb5a50b30883de73ddacb69c96825a761d9
5
5
  SHA512:
6
- metadata.gz: 12aa9c2d7b5e4dac088ea242d121fac94c19ad2f1587eee44ee579a3d3025709fa7fe3fecbe7f8695b22dd4fe998d27e07cfa203b5586e7f6591759ea62833fa
7
- data.tar.gz: 0b5e89bb53695756ecd1c1a3fe81f1354538a01264d005e637a7361ccc0a7f3e3cb30dbea9f0ff5b6298038c28be6e04958444a04a51d57146d05f8e8b04f0fd
6
+ metadata.gz: 7938e08099e7a40edb047df2957e51fd53d339662aa1ac20f9ba2c6a62ac979e1723986347b76f9646ddaa0364138306b4c72106a52beec40b07650e12203150
7
+ data.tar.gz: b4b2284f88a75f1d23accdd782501bc12b3e31ae71e787fa964a5c70bdb974c405d89da262aea8f9c60485be7e26924769bdfedaf9dab735f622e4b63579d505
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.3
4
+
5
+ - Every comment the gem writes opens with one line saying `browser_review_gate` wrote it: the
6
+ assessment, the published report, the paused-review notice and the waiver notice. A published
7
+ report is posted from the developer's account, so without it the comment read as theirs.
8
+
3
9
  ## 0.5.2
4
10
 
5
11
  - A waiver is visible: the gate writes one PR comment saying who waived the run and that later pushes
@@ -128,7 +128,7 @@ module BrowserReviewGate
128
128
  # them to do something. `report` and `commits` give each scenario its status.
129
129
  def markdown(verified:, command:, author: nil, report: nil, commits: nil)
130
130
  payload = Marker.encode(JSON.generate(to_h))
131
- [ "## Browser verification", "", summary(verified, command, author, report, commits), "",
131
+ [ Markdown::SIGNATURE, "", "## Browser verification", "", summary(verified, command, author, report, commits), "",
132
132
  "Assessed commit `#{assessed_sha}`.", "", "<!-- browser-verification-assessment:#{payload} -->" ].join("\n")
133
133
  end
134
134
 
@@ -63,9 +63,9 @@ module BrowserReviewGate
63
63
  comment = comments.find { |item| item.dig("user", "login") == Assessment::AUTHOR && item["body"].to_s.match?(WAIVED) }
64
64
  return comment && @github.delete_comment(comment.fetch("id")) unless waived_by
65
65
 
66
- body = "Browser verification waived by #{Markdown.escape(waived_by)}: review proceeds without a browser run. " \
66
+ body = Markdown.signed("Browser verification waived by #{Markdown.escape(waived_by)}: review proceeds without a browser run. " \
67
67
  "Later pushes do not hold review. Remove the `#{@config.waiver_label}` label to require a run again.\n\n" \
68
- "<!-- browser-review-gate:waived -->"
68
+ "<!-- browser-review-gate:waived -->")
69
69
  if comment.nil?
70
70
  @github.create_comment(number, body)
71
71
  elsif comment["body"] != body
@@ -143,7 +143,7 @@ module BrowserReviewGate
143
143
  end
144
144
 
145
145
  def write_notice(number, comments, text, waiting)
146
- body = "#{text}\n\n<!-- browser-review-gate:paused:#{Marker.encode(JSON.generate(waiting))} -->"
146
+ body = Markdown.signed("#{text}\n\n<!-- browser-review-gate:paused:#{Marker.encode(JSON.generate(waiting))} -->")
147
147
  comment = notice_comment(comments)
148
148
  if comment.nil?
149
149
  @github.create_comment(number, body)
@@ -1,5 +1,10 @@
1
1
  module BrowserReviewGate
2
2
  module Markdown
3
+ # The first line of every comment the gem writes, so a reader knows a tool wrote it, not a person.
4
+ SIGNATURE = "<sub>🤖 Written by [browser_review_gate](https://github.com/Halvanhelv/browser_review_gate)</sub>"
5
+
6
+ def self.signed(text) = "#{SIGNATURE}\n\n#{text}"
7
+
3
8
  # Comment text comes from a model or a report file, so it must not start markup or ping anyone.
4
9
  # "@login " for each person, so a comment that needs them reaches their notifications. Bots and
5
10
  # anything that is not a plain login get no mention.
@@ -151,10 +151,10 @@ module BrowserReviewGate
151
151
  end
152
152
 
153
153
  def body(report, complete, commits)
154
- return report.markdown(commits: commits) if complete
154
+ return Markdown.signed(report.markdown(commits: commits)) if complete
155
155
 
156
- [ "**Not verified.** Complete every required browser scenario and pass all reported cases before human review.",
157
- "", report.markdown(commits: commits) ].join("\n")
156
+ Markdown.signed([ "**Not verified.** Complete every required browser scenario and pass all reported cases before human review.",
157
+ "", report.markdown(commits: commits) ].join("\n"))
158
158
  end
159
159
 
160
160
  # Only the author's own earlier report comment can be edited in place.
@@ -1,3 +1,3 @@
1
1
  module BrowserReviewGate
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browser_review_gate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Islam Gagiev