-
-
Notifications
You must be signed in to change notification settings - Fork 314
feat: add missing fields to IssueCommentWebhookEventPayload #811
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
base: main
Are you sure you want to change the base?
feat: add missing fields to IssueCommentWebhookEventPayload #811
Conversation
Add repository, sender, and installation fields to IssueCommentWebhookEventPayload struct to match the actual GitHub webhook payload structure. - Add repository field (Repository type) - Add sender field (Author type) - Add installation field (Option<InstallationLite> type) - Add InstallationLite struct for lightweight installation info - Add comprehensive test with real webhook payload - Update imports to include new required types This allows consumers to: - Identify which repository the comment was made in - Identify who triggered the event - Access installation information for GitHub Apps Closes XAMPPRocky#810 Signed-off-by: Martin Moreira de Jesus <martin.moreira-de-jesus@protonmail.com>
|
Hey, I need this because I'm integrating a rust operator that allows users to create ephemeral environments on ArgoCD |
Signed-off-by: Martin Moreira de Jesus <martin.moreira-de-jesus@protonmail.com>
Signed-off-by: Martin Moreira de Jesus <martin.moreira-de-jesus@protonmail.com>
|
By fixing the tests, I just found out that you're supposed to use this struct that way: let event_header = headers.event.into_inner();
let event_header_str = serde_json::to_string(&event_header).unwrap();
let webhook_event = WebhookEvent::try_from_header_and_body(&event_header_str, &payload.to_string()).unwrap();
let event_payload = event_header.parse_specific_payload(payload).unwrap();
match event_payload {
WebhookEventPayload::IssueComment(payload) => {
info!("repository: {:?}", webhook_event.repository);
info!("sender: {:?}", webhook_event.sender);
info!("installation: {:?}", webhook_event.installation);
}
_ => {
info!("received unhandled event {:?}", event_payload);
}
}Is this really needed or should we keep things the way they are ? @XAMPPRocky |
|
|
||
| #[test] | ||
| fn should_deserialize_with_correct_payload() { | ||
| let json = include_str!("../../../../tests/resources/issue_comment_webhook_webhook.json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be "resources/issue_comment_webhook_webhook.json", no?
|
@mmoreiradj Can you clarify? I'm not sure what part you asking about. |
What I mean is that this PR adds the fields to the webhook payload (repository, installation and sender), but they are already present on webhook event which you can build from the webhook payload + event header. So this modification really necessary ? |
Add repository, sender, and installation fields to IssueCommentWebhookEventPayload
struct to match the actual GitHub webhook payload structure.
This allows consumers to:
Closes #810
Signed-off-by: Martin Moreira de Jesus martin.moreira-de-jesus@protonmail.com