Skip to content

Automatically remove triage label when changing item status.#82

Merged
Gerrit91 merged 13 commits intomasterfrom
remove-label-on-status-change
Aug 25, 2025
Merged

Automatically remove triage label when changing item status.#82
Gerrit91 merged 13 commits intomasterfrom
remove-label-on-status-change

Conversation

@Gerrit91
Copy link
Contributor

@Gerrit91 Gerrit91 commented Jul 25, 2025

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 ProjectV2Item changed event: google/go-github#3650.

Then the go-playground/webhooks dependency 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. 🙈

@Gerrit91 Gerrit91 requested a review from a team as a code owner July 25, 2025 11:43
@Gerrit91 Gerrit91 marked this pull request as draft July 25, 2025 11:43
@Gerrit91 Gerrit91 force-pushed the remove-label-on-status-change branch from 3da7e6d to 5dc9142 Compare July 25, 2025 11:44
@Gerrit91 Gerrit91 marked this pull request as ready for review July 26, 2025 10:36
dr []*distributeReleases
rd []*releaseDrafter
pa []*projectItemAdd
p2 []*projectV2ItemHandler
Copy link

Choose a reason for hiding this comment

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

As we are refactoring this anyway, can we rename these fields? 😇

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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)
Copy link

Choose a reason for hiding this comment

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

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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?

Copy link

@vknabel vknabel Jul 28, 2025

Choose a reason for hiding this comment

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

Suggested change
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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied your suggestion, but it's a bit harder to review now.

@Gerrit91 Gerrit91 requested a review from vknabel August 18, 2025 07:21
@Gerrit91 Gerrit91 added the triage This should be talked about in the next planning. label Aug 18, 2025
@iljarotar iljarotar removed the triage This should be talked about in the next planning. label Aug 25, 2025
@Gerrit91 Gerrit91 merged commit 191e3be into master Aug 25, 2025
1 check passed
@Gerrit91 Gerrit91 deleted the remove-label-on-status-change branch August 25, 2025 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Automatically remove triage label when changing item status

3 participants