Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitbucketpipelines] resolve "invalid response data" for halted pipelines #9472

Closed
wants to merge 9 commits into from
Prev Previous commit
Next Next commit
prettier 1
  • Loading branch information
reeceappling authored Aug 12, 2023
commit c04c7a3a67c4d9e9910eacc9f515abe9cc59d0a5
11 changes: 8 additions & 3 deletions services/bitbucket/bitbucket-pipelines.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const bitbucketPipelinesSchema = Joi.object({
name: Joi.string().required(),
type: Joi.string().optional(),
}),
}).required().or('result','stage'),
})
.required()
.or('result','stage'),
}),
)
.required(),
Expand Down Expand Up @@ -73,10 +75,13 @@ class BitbucketPipelines extends BaseJsonService {

static transform(data) {
const values = data.values.filter(
value => value.state && (value.state.name === 'COMPLETED' || value.state.name === 'IN_PROGRESS'),
value =>
value.state &&
(value.state.name === 'COMPLETED' ||
value.state.name === 'IN_PROGRESS'),
)
if (values.length > 0) {
if(Object.prototype.hasOwnProperty.call(values[0].state, 'result')) {
if (Object.prototype.hasOwnProperty.call(values[0].state, 'result')) {
return values[0].state.result.name
}
return values[0].state.stage.name
Expand Down