cilium / github-actions

Repository dedicated for the GitHub actions logic executed in cilium/cilium. Also known as the maintainer's little helper (MLH).
Apache License 2.0
5 stars 6 forks source link

automerge: fix panic on status event #57

Closed mhofstetter closed 1 year ago

mhofstetter commented 1 year ago

Currently, client.AutoMerge results in a panic if its called from StatusEvent, because the field prLabels isn't set. This will let the handler fail and return HTTP 500 to the GitHub webhook client.

In contrast to the PullRequestEvent & PullRequestReviewEvent - there might be multiple PRs involved when receiving a StatusEvent. Therefore, this commit removes the labels of a PR from the client fields and introduces a dedicated type PRLabels which gets created and passed explicitly to the individual functions (e.g. client.AutoMerge) if needed.