Skip to content

Commit

Permalink
Add a couple useful outputs for debugging: response body and env fetc…
Browse files Browse the repository at this point in the history
…hing success (#24)

* Add a couple useful outputs for debugging: response body and env fetching success
* Don't try to hit GitHub if the user can't auth
  • Loading branch information
drusepth authored Jul 5, 2017
1 parent ef228e0 commit d6cd859
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/github-deploy.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ module.exports = (robot) ->

if msg.message && (x = getGithubToken(msg.message.user.name))
options.token = x
else
msg.send "Couldn't find GitHub token for #{msg.message.user.name}.\n \
Is #{"HUBOT_GITHUB_USER_#{msg.message.user.name.split(' ')[0].toUpperCase()}_TOKEN"} set?"
return

client = github(robot, options)

client.handleErrors (response) ->
msg.send "An error occurred: #{response.error}"
msg.send "An error occurred: #{response.error}. Raw response:\n>#{response.body}"

client.post "repos/dobtco/#{repoName}/pulls",
title: 'Deploy to production'
Expand Down

0 comments on commit d6cd859

Please sign in to comment.