fix Docker build status invalid response data bug (#8392)

closes #6235
This commit is contained in:
Paula Barszcz
2022-09-11 21:53:54 +02:00
committed by GitHub
parent d8c825a1ad
commit f6b09e9ca3
6 changed files with 51 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
import { BaseJsonService } from '../index.js'
import { BaseJsonService, NotFound } from '../index.js'
import { dockerBlue, buildDockerUrl } from './docker-helpers.js'
import { fetchBuild } from './docker-cloud-common-fetch.js'
@@ -31,6 +31,12 @@ export default class DockerCloudBuild extends BaseJsonService {
async handle({ user, repo }) {
const data = await fetchBuild(this, { user, repo })
if (data.objects.length === 0) {
throw new NotFound({
prettyMessage: `automated builds not set up`,
})
}
return this.constructor.render({ state: data.objects[0].state })
}
}