FIX: GitHub commit onebox should only be used for single commits

FIX: GitHub commit onebox should only be used for single commits

Links to multiple commits will now use the default whitelistedgeneric onebox.

Onebox of github commits overview is just the onebox of the first commit - feature - Discourse Meta

diff --git a/lib/onebox/engine/github_commit_onebox.rb b/lib/onebox/engine/github_commit_onebox.rb
index d598fd1..30bbf9f 100644
--- a/lib/onebox/engine/github_commit_onebox.rb
+++ b/lib/onebox/engine/github_commit_onebox.rb
@@ -7,7 +7,7 @@ module Onebox
       include LayoutSupport
       include JSON
 
-      matches_regexp Regexp.new("^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/commits?/")
+      matches_regexp Regexp.new("^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/commit/")
       always_https
 
       def url
@@ -19,9 +19,9 @@ module Onebox
       def match
         return @match if @match
 
-        @match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/commits?/(?<sha>[^/]+)})
+        @match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/commit/(?<sha>[^/]+)})
 
-        @match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/pull/(?<pr>[^/]+)/commits?/(?<sha>[^/]+)}) if @match.nil?
+        @match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/pull/(?<pr>[^/]+)/commit/(?<sha>[^/]+)}) if @match.nil?
 
         @match
       end
diff --git a/spec/lib/onebox/engine/github_commit_onebox_spec.rb b/spec/lib/onebox/engine/github_commit_onebox_spec.rb
index 8d54133..62673ff 100644
--- a/spec/lib/onebox/engine/github_commit_onebox_spec.rb
+++ b/spec/lib/onebox/engine/github_commit_onebox_spec.rb
@@ -58,8 +58,8 @@ describe Onebox::Engine::GithubCommitOnebox do
 
   describe "PR with commit URL" do
     before(:all) do
-      @link = "https://github.com/discourse/discourse/pull/4662/commits/803d023e2307309f8b776ab3b8b7e38ba91c0919"
-      @uri = "https://api.github.com/repos/discourse/discourse/commits/803d023e2307309f8b776ab3b8b7e38ba91c0919"
+      @link = "https://github.com/discourse/discourse/pull/4662/commit/803d023e2307309f8b776ab3b8b7e38ba91c0919"
+      @uri = "https://api.github.com/repos/discourse/discourse/commit/803d023e2307309f8b776ab3b8b7e38ba91c0919"
     end
 
     include_context "engines"

GitHub sha: 4103d115

This commit has been mentioned on Discourse Meta. There might be relevant details there: