   robot.respond /circle retry (.*) (.*)/i, (msg) ->
     unless checkToken(msg)
       return
-    project = escape(toProject(msg.match[1]))
+    if msg.match[1] is 'all'
+      status = escape(msg.match[2])
+      getProjectsByStatus(msg, endpoint, status, 'retry')
+      return
+    else
+      project = escape(toProject(msg.match[1]))
     build_num = escape(msg.match[2])
     if build_num is 'last'
       branch = 'master'

      .headers("Accept": "application/json")
      .post('{}') handleResponse msg, (response) ->
          msg.send "Retrying build #{build_num} of #{project} [#{response.branch}] with build #{response.build_num}"

checkToken = (msg) ->
  unless process.env.HUBOT_CIRCLECI_TOKEN?

#   hubot circle me <user>/<repo> [branch] - Returns the build status of https://circleci.com/<user>/<repo>
#   hubot circle last <user>/<repo> [branch] - Returns the build status of the last complete build of https://circleci.com/<user>/<repo>
#   hubot circle retry <user>/<repo> <build_num> - Retries the build
#   hubot circle retry all <failed>/<success> - Retries all builds matching the provided status
#   hubot circle cancel <user>/<repo> <build_num> - Cancels the build
#   hubot circle clear <user>/<repo> - Clears the cache for the specified repo
#   hubot circle list <failed>/<success> - Lists all failed/success builds for a given project.
