Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Handle merge conflicts and commit status check failure #529

Merged
merged 1 commit into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion internal/pkg/github/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,21 @@ func (g *Github) CreateRemoteDeployment(ctx context.Context, u *ent.User, r *ent
ProductionEnvironment: env.ProductionEnvironment,
})
if res.StatusCode == http.StatusConflict {
// Determine if there is a merge conflict or a commit status check failed.
// https://github.com/gitploy-io/gitploy/issues/526
for _, es := range err.(*github.ErrorResponse).Errors {
if es.Field == "required_contexts" {
return nil, e.NewErrorWithMessage(
e.ErrorCodeEntityUnprocessable,
"A commit status check failed.",
err,
)
}
}

return nil, e.NewErrorWithMessage(
e.ErrorCodeEntityUnprocessable,
"There is merge conflict or a commit status check failed.",
"There is merge conflict. Retry after resolving the conflict.",
err,
)
} else if res.StatusCode == http.StatusUnprocessableEntity {
Expand Down
Loading