Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: Include PR number in the GitHub PR oneboxes (#37409)

Keegan George1efd0d6643d9
diff --git a/lib/onebox/engine/github_pull_request_onebox.rb b/lib/onebox/engine/github_pull_request_onebox.rb
index ba80bcd6736..5e98833b4dc 100644
--- a/lib/onebox/engine/github_pull_request_onebox.rb
+++ b/lib/onebox/engine/github_pull_request_onebox.rb
@@ -61,6 +61,7 @@ module Onebox
result["pr"] = true
end
+ result["number"] = match[:number]
result["i18n"] = i18n
result["i18n"]["status_date_label"] = status_date_label(result["pr_status"])
result["i18n"]["pr_summary"] = I18n.t(
diff --git a/lib/onebox/templates/githubpullrequest.mustache b/lib/onebox/templates/githubpullrequest.mustache
index 3d0bc9dbeb3..d6561c1260f 100644
--- a/lib/onebox/templates/githubpullrequest.mustache
+++ b/lib/onebox/templates/githubpullrequest.mustache
@@ -62,7 +62,7 @@
{{#pr}}
<h4>
- <a href="{{link}}" target="_blank" rel="noopener">{{title}}</a>
+ <a href="{{link}}" target="_blank" rel="noopener">{{title}} (#{{number}})</a>
</h4>
{{/pr}}
diff --git a/spec/lib/onebox/engine/github_pull_request_onebox_spec.rb b/spec/lib/onebox/engine/github_pull_request_onebox_spec.rb
index febc6fdf624..a5063188e17 100644
--- a/spec/lib/onebox/engine/github_pull_request_onebox_spec.rb
+++ b/spec/lib/onebox/engine/github_pull_request_onebox_spec.rb
@@ -13,6 +13,10 @@ RSpec.describe Onebox::Engine::GithubPullRequestOnebox do
it_behaves_like "an engine"
describe "#to_html" do
+ it "includes pull request title with number" do
+ expect(html).to include("Add audio onebox (#1253)")
+ end
+
it "includes pull request author" do
expect(html).to include("jamesaanderson")
end