UNPKG

895 BJavaScriptView Raw
1const cli = require('heroku-cli-util')
2const co = require('co')
3const api = require('../../lib/heroku-api')
4const TestRun = require('../../lib/test-run')
5const Utils = require('../../lib/utils')
6
7function* run (context, heroku) {
8 const pipeline = yield Utils.getPipeline(context, heroku)
9 const lastRun = yield api.latestTestRun(heroku, pipeline.id)
10
11 if (!lastRun) {
12 return cli.error('No Heroku CI runs found for this pipeline.')
13 }
14
15 return yield TestRun.displayAndExit(pipeline, lastRun.number, { heroku })
16}
17
18module.exports = {
19 topic: 'ci',
20 command: 'last',
21 wantsApp: true,
22 needsAuth: true,
23 description: 'get the results of the last run',
24 flags: [
25 {
26 name: 'pipeline',
27 char: 'p',
28 hasValue: true,
29 description: 'pipeline'
30 }
31 ],
32 help: 'looks for the most recent run and returns the output of that run',
33 run: cli.command(co.wrap(run))
34}