@@ -46,17 +46,15 @@ class EventDataProcessor implements JsonDeserializer<EventData>, JsonSerializer<
4646 map .put ("referenced" , EventData .ReferencedEventData .class );
4747 map .put ("merged" , EventData .ReferencedEventData .class );
4848 map .put ("closed" , EventData .StateChangedEventData .class );
49- map .put ("connected" , EventData .ConnectedEventData .class );
5049 map .put ("reopened" , EventData .StateChangedEventData .class );
50+ map .put ("connected" , EventData .ConnectedEventData .class );
5151 map .put ("issue_type_added" , EventData .IssueTypeChangedEventData .class );
5252 map .put ("issue_type_changed" , EventData .IssueTypeChangedEventData .class );
5353 map .put ("issue_type_removed" , EventData .IssueTypeChangedEventData .class );
5454 map .put ("parent_issue_added" , EventData .ParentIssueChangedEventData .class );
5555 map .put ("parent_issue_removed" , EventData .ParentIssueChangedEventData .class );
56- map .put ("parent_issue_changed" , EventData .ParentIssueChangedEventData .class );
5756 map .put ("sub_issue_added" , EventData .SubIssueChangedEventData .class );
5857 map .put ("sub_issue_removed" , EventData .SubIssueChangedEventData .class );
59- map .put ("sub_issue_changed" , EventData .SubIssueChangedEventData .class );
6058 map .put ("review_requested" , EventData .RequestedReviewEventData .class );
6159 map .put ("review_request_removed" , EventData .RequestedReviewEventData .class );
6260 map .put ("review_dismissed" , EventData .DismissedReviewEventData .class );
@@ -181,13 +179,39 @@ public void postSerialize(JsonElement result, EventData.AssignedEventData src, G
181179 */
182180 static class StateChangedEventProcessor implements PostProcessor <EventData .StateChangedEventData > {
183181
182+ private GitHubRepository repo ;
183+
184+ /**
185+ * Creates a new EventDataProcessor for the given repo.
186+ *
187+ * @param repo
188+ * the repo
189+ */
190+ StateChangedEventProcessor (GitHubRepository repo ) {
191+ this .repo = repo ;
192+ }
193+
184194 @ Override
185195 public void postDeserialize (EventData .StateChangedEventData result , JsonElement src , Gson gson ) {
186196 JsonElement stateReasonElement = src .getAsJsonObject ().get ("state_reason" );
187197 String stateReasonValue = (stateReasonElement != null && !stateReasonElement .isJsonNull ())
188198 ? stateReasonElement .getAsString ()
189199 : null ;
190200 result .state_reason = StateReason .getFromString (stateReasonValue );
201+
202+ JsonElement hash = src .getAsJsonObject ().get ("commit_id" );
203+ if (hash .isJsonNull ()) {
204+ return ;
205+ }
206+
207+ result .commit = repo .getGithubCommit (hash .getAsString ()).orElseGet (() -> {
208+ LOG .warning ("Found commit unknown to GitHub and local git repo: " + hash + " Retry using url..." );
209+ JsonElement url = src .getAsJsonObject ().get ("commit_url" );
210+ return repo .getGithubCommitUrl (hash .getAsString (), url .getAsString ()).orElseGet (() -> {
211+ LOG .warning ("Could not find commit: " + hash );
212+ return null ;
213+ });
214+ });
191215 }
192216
193217 @ Override
@@ -208,34 +232,6 @@ public void postSerialize(JsonElement result, EventData.IssueTypeChangedEventDat
208232 }
209233 }
210234
211- /**
212- * Processor for parent issue change events.
213- */
214- static class ParentIssueChangedEventProcessor implements PostProcessor <EventData .ParentIssueChangedEventData > {
215-
216- @ Override
217- public void postDeserialize (EventData .ParentIssueChangedEventData result , JsonElement src , Gson gson ) {
218- }
219-
220- @ Override
221- public void postSerialize (JsonElement result , EventData .ParentIssueChangedEventData src , Gson gson ) {
222- }
223- }
224-
225- /**
226- * Processor for sub-issue change events.
227- */
228- static class SubIssueChangedEventProcessor implements PostProcessor <EventData .SubIssueChangedEventData > {
229-
230- @ Override
231- public void postDeserialize (EventData .SubIssueChangedEventData result , JsonElement src , Gson gson ) {
232- }
233-
234- @ Override
235- public void postSerialize (JsonElement result , EventData .SubIssueChangedEventData src , Gson gson ) {
236- }
237- }
238-
239235 /**
240236 * Processor for connected events.
241237 */
0 commit comments