Automatically remove triage label when changing item status.#82
Automatically remove triage label when changing item status.#82
Conversation
3da7e6d to
5dc9142
Compare
| dr []*distributeReleases | ||
| rd []*releaseDrafter | ||
| pa []*projectItemAdd | ||
| p2 []*projectV2ItemHandler |
There was a problem hiding this comment.
As we are refactoring this anyway, can we rename these fields? 😇
There was a problem hiding this comment.
We can do a refactoring PR, if we start this here it would blow the PR up even more?
| err := a.AddDocsPreviewComment(ctx, params) | ||
| if err != nil { | ||
| w.logger.Error("error adding docs preview comment to docs", "repo", payload.Repository.Name, "pull_request", params.PullRequestNumber, "error", err) | ||
| w.logger.Error("error adding docs preview comment to docs", "repo", *payload.Repo.Name, "pull_request", params.PullRequestNumber, "error", err) |
There was a problem hiding this comment.
not that this should happen in practice, but in case payload.Repo.Name is actually nil, it is likely to produce an error within this request.
Should we add a var-block above with multiple pointer.SafeDeref?
There was a problem hiding this comment.
The nil validations are really painful with the new event definitions... I am not sure how to deal with it. Also if there was an empty string the behavior of the robot would turn into something completely unforeseeable. Maybe there's smart solution with JSON marshaling and unmarshaling + defining a struct linter?
There was a problem hiding this comment.
| w.logger.Error("error adding docs preview comment to docs", "repo", *payload.Repo.Name, "pull_request", params.PullRequestNumber, "error", err) | |
| w.logger.Error("error adding docs preview comment to docs", "repo", pointer.SafeDeref(payload.Repo.Name), "pull_request", params.PullRequestNumber, "error", err) |
unsure about what you mean, but could be moved to a later refactoring, too.
There was a problem hiding this comment.
Applied your suggestion, but it's a bit harder to review now.
Description
Closes #80.
Unfortunately, I had to change quite a lot to make this happen.
First, I had to fork go-github and add a missing property on the
ProjectV2Itemchanged event: google/go-github#3650.Then the
go-playground/webhooksdependency does not provide the webhook event for project v2 items. In general this project does not seem to be maintained a lot. The go-github dependency also provides a possibility to parse these webhook events and is more complete, so I changed everything to go-github. The disadvantage is that all their fields are pointers. 🙈