     path: url.pathname
     headers:
       "Authorization": "Basic #{auth}"
+
+buildsStatus = (builds) ->
+  buildsLength = builds.length
+  response = ""
+
+  if buildsLength > 0
+    builds.forEach (build) ->
+      response += buildStatusMessage(build)
+      response += "\n" if buildsLength > 1
+
+  response
+
+buildStatusMessage = (build) ->
+  response = ""
+  response += "Build ##{build.number} (#{build.sha1}) of #{build.repo}/#{build.branch} #{build.status}"
+  response += "(#{build.duration}s) #{build.compare}"
+  response += " [Log: #{build.web_url}]"
+
 
 get = (path, params, cb) ->
   options = defaultOptions()

      count = 1

    get "#{app}/#{branch}?limit=#{count}", { }, (err, statusCode, body) ->
      response = ""
      builds = JSON.parse(body)

      builds.forEach (build) ->
        response += "Build ##{build.number} (#{build.sha1}) of #{build.repo}/#{build.branch} #{build.status}"
        response += "(#{build.duration}s) #{build.compare}"
        response += "\n" if count > 1

      msg.send response


    limit = msg.match[1]
    building = msg.match[2]?
    get "builds?limit=#{limit}&building=#{building}", {}, (err, statusCode, body) ->
      builds = JSON.parse(body)
      response = buildsStatus(builds) || "Builds? Sorry, there's no builds here"

      msg.send response

  robot.respond /ci status$/i, (msg) ->
    get "", {}, (err, statusCode, body) ->
