       password: password
   , callback
 
+getLastedReleaseTime = new Promise (resolve, reject) ->
+  callGithubAPI
+    url: repoUrl + LATEST_RELEASE_PATH
+    callback: (error, response, body) ->
+      if (!error and response.statusCode isnt 200)
+        console.log error, body
+        reject error
+      else
+        lastedReleaseTime = new Date(JSON.parse(body).created_at)
+        console.log "Last release time is #{lastedReleaseTime.toLocaleTimeString()} #{lastedReleaseTime.toLocaleDateString()}"
+        resolve(lastedReleaseTime)
+
 getClosedPullRequestsAfter = (time) ->
-  callGithubAPI (repoUrl + RECENT_CLOSED_PR_PATH), (error, response, body) ->
-    if (!error and response.statusCode isnt 200)
-      console.log error, body
-    else
-      pullRequests = JSON.parse(body).filter (pullRequest) ->
-        new Date(pullRequest.merged_at) > time
-      if pullRequests.length
-        printPullRequestsReport(pullRequests)
+  callGithubAPI
+    url: repoUrl + RECENT_CLOSED_PR_PATH
+    callback: (error, response, body) ->
+      if (!error and response.statusCode isnt 200)
+        console.log error, body
       else
-        console.log 'No new pull requests be merged.'
-
-getLastedReleaseTime = new Promise (resolve, reject) ->
-  callGithubAPI (repoUrl + LATEST_RELEASE_PATH),  (error, response, body) ->
-    if (!error and response.statusCode isnt 200)
-      reject error
-    else
-      lastedReleaseTime = new Date(JSON.parse(body).created_at)
-      console.log "Last release time is #{lastedReleaseTime.toLocaleTimeString()} #{lastedReleaseTime.toLocaleDateString()}"
-      resolve(lastedReleaseTime)
+        pullRequests = JSON.parse(body).filter (pullRequest) ->
+          new Date(pullRequest.merged_at) > time
+        if pullRequests.length
+          printPullRequestsReport(pullRequests)
+        else
+          console.log 'No new pull requests be merged.'
 
 printPullRequestsReport = (pullRequests) ->
   index = 1

    console.log "#{index}. #{pullRequest.title} by @#{pullRequest.user.login}"
    index++

getLastedReleaseTime.then getClosedPullRequestsAfter


repoUrl = "#{GITHUB_REPO_API_ROOT}#{repoOwner}/#{repoName}"

callGithubAPI = ({url, callback}) ->
  request
    url: url
    headers:
