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

Change to select reviewers into static reviewers #201

Merged
merged 13 commits into from
Nov 4, 2021
Merged

Change to select reviewers into static reviewers #201

merged 13 commits into from
Nov 4, 2021

Conversation

noahingh
Copy link
Member

@noahingh noahingh commented Nov 2, 2021

Todo:

  • Fix the search API
  • Fix the event API
  • Remove Approval in codes

@noahingh noahingh added this to the v0.3 milestone Nov 2, 2021
@noahingh noahingh linked an issue Nov 2, 2021 that may be closed by this pull request
Comment on lines +48 to +61
i.log.Debug("Save the deployment to wait reviews.")
d, err = i.Store.CreateDeployment(ctx, d)
if err != nil {
return nil, err
}

for _, rvr := range env.Review.Reviewers {
i.log.Debug(fmt.Sprintf("Request a review to %s.", rvr))
if _, err := i.requestReviewByLogin(ctx, d, rvr); err != nil {
i.log.Error("Failed to request the review.", zap.Error(err))
}
}

return d, nil
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the review is enabled, Gitploy requests reviews to users.

Comment on lines +101 to +115
rvs, _ := i.ListReviews(ctx, d)

for _, r := range rvs {
if r.Status == review.StatusRejected {
return false
}
}

approved := 0
for _, a := range as {
if a.Status == approval.StatusApproved {
approved = approved + 1
for _, r := range rvs {
if r.Status == review.StatusApproved {
return true
}
}

return approved >= d.RequiredApprovalCount
return false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a rejection, it blocks to deploy to GitHub. It needs at least one approval to deploy.

@noahingh noahingh marked this pull request as ready for review November 4, 2021 13:29
@noahingh noahingh merged commit 5032049 into main Nov 4, 2021
@noahingh noahingh deleted the add-review branch November 4, 2021 13:32
@noahingh noahingh added component: server This issue or pull request is related to the feature of the server-side component: ui This issue or pull request is related to the feature of the UI-side schema-migration This pull request has a schema-migration labels Nov 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: server This issue or pull request is related to the feature of the server-side component: ui This issue or pull request is related to the feature of the UI-side schema-migration This pull request has a schema-migration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change to select reviewers into static reviewers
1 participant