1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Extract GitHub actor IDs from GitHub events

Summary: Ref T10538. This probably gets push events where GitHub does not recognize the author wrong, but I don't have any of those yet.

Test Plan: Added and ran unit tests.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10538

Differential Revision: https://secure.phabricator.com/D15540
This commit is contained in:
epriestley 2016-03-28 11:43:44 -07:00
parent f9306c2e58
commit e5427a9521
21 changed files with 44 additions and 19 deletions

View file

@ -236,6 +236,11 @@ final class NuanceGitHubRawEvent extends Phobject {
$title); $title);
} }
public function getActorGitHubUserID() {
$raw = $this->raw;
return (int)idxv($raw, array('actor', 'id'));
}
private function getTargetObjectName() { private function getTargetObjectName() {
if ($this->isPullRequestEvent()) { if ($this->isPullRequestEvent()) {
$number = $this->getRawIssueNumber(); $number = $this->getRawIssueNumber();

View file

@ -52,6 +52,7 @@ final class NuanceGitHubRawEventTestCase
'uri' => $event->getURI(), 'uri' => $event->getURI(),
'title.full' => $event->getEventFullTitle(), 'title.full' => $event->getEventFullTitle(),
'comment' => $event->getComment(), 'comment' => $event->getComment(),
'actor.id' => $event->getActorGitHubUserID(),
); );
// Only verify the keys which are actually present in the test. This // Only verify the keys which are actually present in the test. This

View file

@ -113,5 +113,6 @@
"issue.number": 1, "issue.number": 1,
"id": 583217900, "id": 583217900,
"uri": "https://github.com/epriestley/poems/issues/1#event-583217900", "uri": "https://github.com/epriestley/poems/issues/1#event-583217900",
"title.full": "GitHub epriestley/poems Issue #1 (Assigned: epriestley)" "title.full": "GitHub epriestley/poems Issue #1 (Assigned: epriestley)",
"actor.id": 102631
} }

View file

@ -75,5 +75,6 @@
"issue.number": 1, "issue.number": 1,
"id": 583218864, "id": 583218864,
"uri": "https://github.com/epriestley/poems/issues/1#event-583218864", "uri": "https://github.com/epriestley/poems/issues/1#event-583218864",
"title.full": "GitHub epriestley/poems Issue #1 (Closed)" "title.full": "GitHub epriestley/poems Issue #1 (Closed)",
"actor.id": 102631
} }

View file

@ -78,5 +78,6 @@
"issue.number": 1, "issue.number": 1,
"id": 583218613, "id": 583218613,
"uri": "https://github.com/epriestley/poems/issues/1#event-583218613", "uri": "https://github.com/epriestley/poems/issues/1#event-583218613",
"title.full": "GitHub epriestley/poems Issue #1 (Removed Milestone: b)" "title.full": "GitHub epriestley/poems Issue #1 (Removed Milestone: b)",
"actor.id": 102631
} }

View file

@ -79,5 +79,6 @@
"issue.number": 1, "issue.number": 1,
"id": 583217784, "id": 583217784,
"uri": "https://github.com/epriestley/poems/issues/1#event-583217784", "uri": "https://github.com/epriestley/poems/issues/1#event-583217784",
"title.full": "GitHub epriestley/poems Issue #1 (Added Label: bug)" "title.full": "GitHub epriestley/poems Issue #1 (Added Label: bug)",
"actor.id": 102631
} }

View file

@ -78,5 +78,6 @@
"issue.number": 1, "issue.number": 1,
"id": 583217866, "id": 583217866,
"uri": "https://github.com/epriestley/poems/issues/1#event-583217866", "uri": "https://github.com/epriestley/poems/issues/1#event-583217866",
"title.full": "GitHub epriestley/poems Issue #1 (Added Milestone: b)" "title.full": "GitHub epriestley/poems Issue #1 (Added Milestone: b)",
"actor.id": 102631
} }

View file

@ -79,5 +79,6 @@
"issue.number": 1, "issue.number": 1,
"id": 583218162, "id": 583218162,
"uri": "https://github.com/epriestley/poems/issues/1#event-583218162", "uri": "https://github.com/epriestley/poems/issues/1#event-583218162",
"title.full": "GitHub epriestley/poems Issue #1 (Renamed)" "title.full": "GitHub epriestley/poems Issue #1 (Renamed)",
"actor.id": 102631
} }

View file

@ -75,5 +75,6 @@
"issue.number": 1, "issue.number": 1,
"id": 583218814, "id": 583218814,
"uri": "https://github.com/epriestley/poems/issues/1#event-583218814", "uri": "https://github.com/epriestley/poems/issues/1#event-583218814",
"title.full": "GitHub epriestley/poems Issue #1 (Reopened)" "title.full": "GitHub epriestley/poems Issue #1 (Reopened)",
"actor.id": 102631
} }

View file

@ -113,5 +113,6 @@
"issue.number": 1, "issue.number": 1,
"id": 583218511, "id": 583218511,
"uri": "https://github.com/epriestley/poems/issues/1#event-583218511", "uri": "https://github.com/epriestley/poems/issues/1#event-583218511",
"title.full": "GitHub epriestley/poems Issue #1 (Unassigned: epriestley)" "title.full": "GitHub epriestley/poems Issue #1 (Unassigned: epriestley)",
"actor.id": 102631
} }

View file

@ -79,5 +79,6 @@
"issue.number": 1, "issue.number": 1,
"id": 583218703, "id": 583218703,
"uri": "https://github.com/epriestley/poems/issues/1#event-583218703", "uri": "https://github.com/epriestley/poems/issues/1#event-583218703",
"title.full": "GitHub epriestley/poems Issue #1 (Removed Label: bug)" "title.full": "GitHub epriestley/poems Issue #1 (Removed Label: bug)",
"actor.id": 102631
} }

View file

@ -75,5 +75,6 @@
"issue.number": 1, "issue.number": 1,
"id": 583218062, "id": 583218062,
"uri": "https://github.com/epriestley/poems/issues/1#event-583218062", "uri": "https://github.com/epriestley/poems/issues/1#event-583218062",
"title.full": "GitHub epriestley/poems Issue #1 (Unlocked)" "title.full": "GitHub epriestley/poems Issue #1 (Unlocked)",
"actor.id": 102631
} }

View file

@ -33,5 +33,6 @@
"pull.number": null, "pull.number": null,
"id": 3784548642, "id": 3784548642,
"uri": "https://github.com/epriestley/poems/commits/phabricator/diff/400", "uri": "https://github.com/epriestley/poems/commits/phabricator/diff/400",
"title.full": "GitHub epriestley/poems Tag phabricator/diff/400 (Created)" "title.full": "GitHub epriestley/poems Tag phabricator/diff/400 (Created)",
"actor.id": 102631
} }

View file

@ -161,5 +161,6 @@
"id": 3740938746, "id": 3740938746,
"uri": "https://github.com/epriestley/poems/pull/2#issuecomment-194282800", "uri": "https://github.com/epriestley/poems/pull/2#issuecomment-194282800",
"title.full": "GitHub epriestley/poems Pull Request #2 (Comment)", "title.full": "GitHub epriestley/poems Pull Request #2 (Comment)",
"comment": "wub wub" "comment": "wub wub",
"actor.id": 102631
} }

View file

@ -98,5 +98,6 @@
"id": 3733510485, "id": 3733510485,
"uri": "https://github.com/epriestley/poems/issues/1#issuecomment-193528669", "uri": "https://github.com/epriestley/poems/issues/1#issuecomment-193528669",
"title.full": "GitHub epriestley/poems Issue #1 (Comment)", "title.full": "GitHub epriestley/poems Issue #1 (Comment)",
"comment": "comment on issue" "comment": "comment on issue",
"actor.id": 102631
} }

View file

@ -69,5 +69,6 @@
"issue.number": 1, "issue.number": 1,
"id": 3740905151, "id": 3740905151,
"uri": "https://github.com/epriestley/poems/issues/1#event-3740905151", "uri": "https://github.com/epriestley/poems/issues/1#event-3740905151",
"title.full": "GitHub epriestley/poems Issue #1 (Closed)" "title.full": "GitHub epriestley/poems Issue #1 (Closed)",
"actor.id": 102631
} }

View file

@ -69,5 +69,6 @@
"issue.number": 1, "issue.number": 1,
"id": 3733509737, "id": 3733509737,
"uri": "https://github.com/epriestley/poems/issues/1#event-3733509737", "uri": "https://github.com/epriestley/poems/issues/1#event-3733509737",
"title.full": "GitHub epriestley/poems Issue #1 (Created)" "title.full": "GitHub epriestley/poems Issue #1 (Created)",
"actor.id": 102631
} }

View file

@ -69,5 +69,6 @@
"issue.number": 1, "issue.number": 1,
"id": 3740908680, "id": 3740908680,
"uri": "https://github.com/epriestley/poems/issues/1#event-3740908680", "uri": "https://github.com/epriestley/poems/issues/1#event-3740908680",
"title.full": "GitHub epriestley/poems Issue #1 (Reopened)" "title.full": "GitHub epriestley/poems Issue #1 (Reopened)",
"actor.id": 102631
} }

View file

@ -333,5 +333,6 @@
"pull.number": 2, "pull.number": 2,
"id": 3740936638, "id": 3740936638,
"uri": "https://github.com/epriestley/poems/pull/2#event-3740936638", "uri": "https://github.com/epriestley/poems/pull/2#event-3740936638",
"title.full": "GitHub epriestley/poems Pull Request #2 (Created)" "title.full": "GitHub epriestley/poems Pull Request #2 (Created)",
"actor.id": 102631
} }

View file

@ -44,5 +44,6 @@
"issue.number": null, "issue.number": null,
"id": 3498724127, "id": 3498724127,
"uri": "https://github.com/epriestley/poems/commits/c829132d37c4c1da80d319942a5a1e500632b52f", "uri": "https://github.com/epriestley/poems/commits/c829132d37c4c1da80d319942a5a1e500632b52f",
"title.full": "GitHub epriestley/poems Branch master (Pushed: c829132d37c4)" "title.full": "GitHub epriestley/poems Branch master (Pushed: c829132d37c4)",
"actor.id": 102631
} }

View file

@ -28,5 +28,6 @@
"pull.number": null, "pull.number": null,
"id": 3740950917, "id": 3740950917,
"uri": null, "uri": null,
"title.full": "GitHub epriestley/poems User epriestley (Watched)" "title.full": "GitHub epriestley/poems User epriestley (Watched)",
"actor.id": 102631
} }