1 | const cli = require('heroku-cli-util')
|
2 | const co = require('co')
|
3 | const api = require('../../lib/heroku-api')
|
4 | const TestRun = require('../../lib/test-run')
|
5 |
|
6 | function* run (context, heroku) {
|
7 | const coupling = yield api.pipelineCoupling(heroku, context.app)
|
8 | const pipeline = coupling.pipeline
|
9 | const pipelineID = pipeline.id
|
10 | const lastRun = yield api.latestTestRun(heroku, pipelineID)
|
11 |
|
12 | if (!lastRun) {
|
13 | return cli.error('No Heroku CI runs found for this pipeline.')
|
14 | }
|
15 |
|
16 | return yield TestRun.displayAndExit(pipeline, lastRun.number, { heroku })
|
17 | }
|
18 |
|
19 | module.exports = {
|
20 | topic: 'ci',
|
21 | command: 'last',
|
22 | needsApp: true,
|
23 | needsAuth: true,
|
24 | description: 'get the results of the last run',
|
25 | help: 'looks for the most recent run and returns the output of that run',
|
26 | run: cli.command(co.wrap(run))
|
27 | }
|