From b2efd2977ab62eedf03bc79c2a02b3bee6688342 Mon Sep 17 00:00:00 2001 From: Yaron de Leeuw Date: Wed, 10 Dec 2014 21:41:34 +0200 Subject: [PATCH] Appveyor: allow specific branch --- server.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index ee91b8f..dfa77fc 100644 --- a/server.js +++ b/server.js @@ -346,11 +346,15 @@ cache(function(data, match, sendBadge, request) { })); // AppVeyor CI integration. -camp.route(/^\/appveyor\/ci\/(.*)\.(svg|png|gif|jpg|json)$/, +camp.route(/^\/appveyor\/ci\/([^\/]+\/[^\/]+)(?:\/(.+))?\.(svg|png|gif|jpg|json)$/, cache(function(data, match, sendBadge, request) { var repo = match[1]; // eg, `gruntjs/grunt`. - var format = match[2]; + var branch = match[2]; + var format = match[3]; var apiUrl = 'https://ci.appveyor.com/api/projects/' + repo; + if (branch != null) { + apiUrl += '/branch/' + branch; + } var badgeData = getBadgeData('build', data); request(apiUrl, { headers: { 'Accept': 'application/json' } }, function(err, res, buffer) { if (err != null) {