-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: ProcessDeployProtectionRuleWebhookAsync seems to have the wrong argument type #546
Comments
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
I was able to work around this with the following: public override WebhookEvent DeserializeWebhookEvent(WebhookHeaders headers, string body)
{
return headers.Event switch
{
"deployment_protection_rule" => JsonSerializer.Deserialize<DeploymentProtectionRuleRequestedEvent>(body),
_ => base.DeserializeWebhookEvent(headers, body)
};
}
protected override async Task ProcessDeployProtectionRuleWebhookAsync(
WebhookHeaders headers,
DeploymentProtectionRuleEvent deploymentProtectionRuleEvent,
DeploymentProtectionRuleAction action
)
{
if (deploymentProtectionRuleEvent is DeploymentProtectionRuleRequestedEvent deploymentProtectionRuleRequestedEvent)
{
await ProcessDeployProtectionRuleRequestedAsync(deploymentProtectionRuleRequestedEvent);
}
}
protected async Task ProcessDeployProtectionRuleRequestedAsync(
DeploymentProtectionRuleRequestedEvent evt
)
{
// todo: implement...
} |
I don't think this is a bug. The pattern we're following is that we have a common abstract class that contains all the common properties between each different event action type, and each concrete action type only has the specific properties for the action. So I think your workaround is not so much a workaround, but how I would expect the SDK to be used. All you should need is: protected override async Task ProcessDeployProtectionRuleWebhookAsync(
WebhookHeaders headers,
DeploymentProtectionRuleEvent deploymentProtectionRuleEvent,
DeploymentProtectionRuleAction action
)
{
if (deploymentProtectionRuleEvent is DeploymentProtectionRuleRequestedEvent deploymentProtectionRuleRequestedEvent)
{
// do whatever here
}
} I think we could also move the properties from |
What happened?
The second argument is of type
DeploymentProtectionRuleEvent
but it should beDeploymentProtectionRuleRequestedEvent
.There are a bunch of fields on the payload that are inaccessible as a result.
Bug is on this line:
https://github.com/octokit/webhooks.net/blob/main/src/Octokit.Webhooks/WebhookEventProcessor.cs#L178
Should be:
Versions
webhooks.net latest version
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: