Skip to content

Instantly share code, notes, and snippets.

@horie1024
Created October 14, 2015 02:10
Show Gist options
  • Save horie1024/1506ef6cc7314bd3a072 to your computer and use it in GitHub Desktop.
Save horie1024/1506ef6cc7314bd3a072 to your computer and use it in GitHub Desktop.
aws = require 'aws-sdk'
robot.catchAll (msg) ->
matches = msg.message.text.match(/@vasilybot\s*(.*)/)
if matches == null or matches.length == 0
return
runArn = matches[1]
msg.send 'ok, start watching run.'
devicefarm = new aws.DeviceFarm({region: 'us-west-2'})
timer = setInterval ->
devicefarm.getRun {arn: runArn}, (err, data) ->
if data == null
msg.send "Invalid parameter. Please check the value of ARN."
clearInterval(timer)
return
if data.run.status == 'COMPLETED'
msg.send 'Result: ' + data.run.result
clearInterval(timer)
, 60000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment