diff --git a/src/githubctl/pull_request_event.rs b/src/githubctl/pull_request_event.rs index 944b023..a91d270 100644 --- a/src/githubctl/pull_request_event.rs +++ b/src/githubctl/pull_request_event.rs @@ -4,6 +4,7 @@ use crate::json_util::get_json_string; pub struct PullRequestEvent<'a> { original_event: &'a serde_json::Value, pub action: &'a String, + pub html_url: &'a String, } impl<'a> PullRequestEvent<'a> { @@ -12,14 +13,23 @@ impl<'a> PullRequestEvent<'a> { .get("payload") .map(get_json_object) .expect("Ran into a PullRequestEvent without a payload."); - let action = payload + let payload_action = payload .get("action") .map(get_json_string) .expect("Ran into a PullRequestEvent without a payload.action."); + let payload_pull_request = payload + .get("pull_request") + .map(get_json_object) + .expect("Ran into a PullRequestEvent without a payload.pull_request."); + let payload_pull_request_html_url = payload_pull_request + .get("html_url") + .map(get_json_string) + .expect("Ran into a PullRequestEvent without a payload.pull_request.html_url."); Ok(PullRequestEvent { original_event, - action, + action: payload_action, + html_url: payload_pull_request_html_url, }) }