{"action":"created","comment":{"url":"https://api.github.com/repos/chaosbot/Chaos/pulls/comments/118628379","pull_request_review_id":40439209,"id":118628379,"diff_hunk":"@@ -101,15 +102,25 @@ def close_pr(api, urn, pr):\n     return api(\"patch\", path, json=data)\n \n \n-def get_pr_last_updated(pr_data):\n+def get_pr_last_updated(api, urn, pr_data):\n     \"\"\" a helper for finding the utc datetime of the last pr branch\n     modifications \"\"\"\n-    repo = pr_data[\"head\"][\"repo\"]\n-    if repo:\n-        dt = repo[\"pushed_at\"]\n-    else:\n-        dt = pr_data[\"created_at\"]\n-    return arrow.get(dt)\n+\n+    # read about github's merge test commit\n+    # https://developer.github.com/v3/pulls/#get-a-single-pull-request\n+    # essentially what github does is, when it sees a new push to a PR, it will\n+    # start a background job to test the commit for mergeability.  this\n+    # background job creates a magical floating merge commit not really attached\n+    # to any branch.  however, this commit is real and its committer is\n+    # \"GitHub\"...and it has a commit date that we can assume is never malicious.\n+    # And it's always updated on a new push to the PR's branch\n+    #\n+    # using all of these facts, we are able to determine the true, reliable,\n+    # last update time of the branch backing a PR\n+    github_test_merge_commit = pr_data[\"merge_commit_sha\"]\n+    commit = commits.get_commit(api, urn, github_test_merge_commit)","path":"github_api/prs.py","position":35,"original_position":35,"commit_id":"58ae2cdded86ef579ec87f12dca13ed48d93933a","original_commit_id":"58ae2cdded86ef579ec87f12dca13ed48d93933a","user":{"login":"reddraggone9","id":2711644,"avatar_url":"https://avatars1.githubusercontent.com/u/2711644?v=3","gravatar_id":"","url":"https://api.github.com/users/reddraggone9","html_url":"https://github.com/reddraggone9","followers_url":"https://api.github.com/users/reddraggone9/followers","following_url":"https://api.github.com/users/reddraggone9/following{/other_user}","gists_url":"https://api.github.com/users/reddraggone9/gists{/gist_id}","starred_url":"https://api.github.com/users/reddraggone9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddraggone9/subscriptions","organizations_url":"https://api.github.com/users/reddraggone9/orgs","repos_url":"https://api.github.com/users/reddraggone9/repos","events_url":"https://api.github.com/users/reddraggone9/events{/privacy}","received_events_url":"https://api.github.com/users/reddraggone9/received_events","type":"User","site_admin":false},"body":"The linked docs don't say so, but is it seems possible that there might not be a `\"merge_commit_sha\"` before GitHub has tested for mergeability or even while it's doing so. Since you don't account for that, have you tested this?","created_at":"2017-05-26T03:32:39Z","updated_at":"2017-05-26T03:32:39Z","html_url":"https://github.com/chaosbot/Chaos/pull/271#discussion_r118628379","pull_request_url":"https://api.github.com/repos/chaosbot/Chaos/pulls/271","_links":{"self":{"href":"https://api.github.com/repos/chaosbot/Chaos/pulls/comments/118628379"},"html":{"href":"https://github.com/chaosbot/Chaos/pull/271#discussion_r118628379"},"pull_request":{"href":"https://api.github.com/repos/chaosbot/Chaos/pulls/271"}}},"pull_request":{"url":"https://api.github.com/repos/chaosbot/Chaos/pulls/271","id":122559833,"html_url":"https://github.com/chaosbot/Chaos/pull/271","diff_url":"https://github.com/chaosbot/Chaos/pull/271.diff","patch_url":"https://github.com/chaosbot/Chaos/pull/271.patch","issue_url":"https://api.github.com/repos/chaosbot/Chaos/issues/271","number":271,"state":"open","locked":false,"title":"get true PR pushed_at datetime","user":{"login":"amoffat","id":259113,"avatar_url":"https://avatars0.githubusercontent.com/u/259113?v=3","gravatar_id":"","url":"https://api.github.com/users/amoffat","html_url":"https://github.com/amoffat","followers_url":"https://api.github.com/users/amoffat/followers","following_url":"https://api.github.com/users/amoffat/following{/other_user}","gists_url":"https://api.github.com/users/amoffat/gists{/gist_id}","starred_url":"https://api.github.com/users/amoffat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amoffat/subscriptions","organizations_url":"https://api.github.com/users/amoffat/orgs","repos_url":"https://api.github.com/users/amoffat/repos","events_url":"https://api.github.com/users/amoffat/events{/privacy}","received_events_url":"https://api.github.com/users/amoffat/received_events","type":"User","site_admin":false},"body":"This should fix a number of issues, but it needs sanity checking.  Underlying issue mentioned https://github.com/chaosbot/Chaos/issues/199 and https://github.com/chaosbot/Chaos/issues/147 and https://github.com/chaosbot/Chaos/pull/239#issuecomment-304165440","created_at":"2017-05-26T02:03:59Z","updated_at":"2017-05-26T03:32:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6ec5581ec595754908c37cd7e1d66c0c3fad684e","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/chaosbot/Chaos/pulls/271/commits","review_comments_url":"https://api.github.com/repos/chaosbot/Chaos/pulls/271/comments","review_comment_url":"https://api.github.com/repos/chaosbot/Chaos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chaosbot/Chaos/issues/271/comments","statuses_url":"https://api.github.com/repos/chaosbot/Chaos/statuses/58ae2cdded86ef579ec87f12dca13ed48d93933a","head":{"label":"amoffat:separate-branches","ref":"separate-branches","sha":"58ae2cdded86ef579ec87f12dca13ed48d93933a","user":{"login":"amoffat","id":259113,"avatar_url":"https://avatars0.githubusercontent.com/u/259113?v=3","gravatar_id":"","url":"https://api.github.com/users/amoffat","html_url":"https://github.com/amoffat","followers_url":"https://api.github.com/users/amoffat/followers","following_url":"https://api.github.com/users/amoffat/following{/other_user}","gists_url":"https://api.github.com/users/amoffat/gists{/gist_id}","starred_url":"https://api.github.com/users/amoffat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amoffat/subscriptions","organizations_url":"https://api.github.com/users/amoffat/orgs","repos_url":"https://api.github.com/users/amoffat/repos","events_url":"https://api.github.com/users/amoffat/events{/privacy}","received_events_url":"https://api.github.com/users/amoffat/received_events","type":"User","site_admin":false},"repo":{"id":92092632,"name":"Chaos","full_name":"amoffat/Chaos","owner":{"login":"amoffat","id":259113,"avatar_url":"https://avatars0.githubusercontent.com/u/259113?v=3","gravatar_id":"","url":"https://api.github.com/users/amoffat","html_url":"https://github.com/amoffat","followers_url":"https://api.github.com/users/amoffat/followers","following_url":"https://api.github.com/users/amoffat/following{/other_user}","gists_url":"https://api.github.com/users/amoffat/gists{/gist_id}","starred_url":"https://api.github.com/users/amoffat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amoffat/subscriptions","organizations_url":"https://api.github.com/users/amoffat/orgs","repos_url":"https://api.github.com/users/amoffat/repos","events_url":"https://api.github.com/users/amoffat/events{/privacy}","received_events_url":"https://api.github.com/users/amoffat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amoffat/Chaos","description":"A social coding experiment that updates its own code democratically.","fork":true,"url":"https://api.github.com/repos/amoffat/Chaos","forks_url":"https://api.github.com/repos/amoffat/Chaos/forks","keys_url":"https://api.github.com/repos/amoffat/Chaos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amoffat/Chaos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amoffat/Chaos/teams","hooks_url":"https://api.github.com/repos/amoffat/Chaos/hooks","issue_events_url":"https://api.github.com/repos/amoffat/Chaos/issues/events{/number}","events_url":"https://api.github.com/repos/amoffat/Chaos/events","assignees_url":"https://api.github.com/repos/amoffat/Chaos/assignees{/user}","branches_url":"https://api.github.com/repos/amoffat/Chaos/branches{/branch}","tags_url":"https://api.github.com/repos/amoffat/Chaos/tags","blobs_url":"https://api.github.com/repos/amoffat/Chaos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amoffat/Chaos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amoffat/Chaos/git/refs{/sha}","trees_url":"https://api.github.com/repos/amoffat/Chaos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amoffat/Chaos/statuses/{sha}","languages_url":"https://api.github.com/repos/amoffat/Chaos/languages","stargazers_url":"https://api.github.com/repos/amoffat/Chaos/stargazers","contributors_url":"https://api.github.com/repos/amoffat/Chaos/contributors","subscribers_url":"https://api.github.com/repos/amoffat/Chaos/subscribers","subscription_url":"https://api.github.com/repos/amoffat/Chaos/subscription","commits_url":"https://api.github.com/repos/amoffat/Chaos/commits{/sha}","git_commits_url":"https://api.github.com/repos/amoffat/Chaos/git/commits{/sha}","comments_url":"https://api.github.com/repos/amoffat/Chaos/comments{/number}","issue_comment_url":"https://api.github.com/repos/amoffat/Chaos/issues/comments{/number}","contents_url":"https://api.github.com/repos/amoffat/Chaos/contents/{+path}","compare_url":"https://api.github.com/repos/amoffat/Chaos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amoffat/Chaos/merges","archive_url":"https://api.github.com/repos/amoffat/Chaos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amoffat/Chaos/downloads","issues_url":"https://api.github.com/repos/amoffat/Chaos/issues{/number}","pulls_url":"https://api.github.com/repos/amoffat/Chaos/pulls{/number}","milestones_url":"https://api.github.com/repos/amoffat/Chaos/milestones{/number}","notifications_url":"https://api.github.com/repos/amoffat/Chaos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amoffat/Chaos/labels{/name}","releases_url":"https://api.github.com/repos/amoffat/Chaos/releases{/id}","deployments_url":"https://api.github.com/repos/amoffat/Chaos/deployments","created_at":"2017-05-22T19:39:55Z","updated_at":"2017-05-26T01:50:31Z","pushed_at":"2017-05-26T02:01:50Z","git_url":"git://github.com/amoffat/Chaos.git","ssh_url":"git@github.com:amoffat/Chaos.git","clone_url":"https://github.com/amoffat/Chaos.git","svn_url":"https://github.com/amoffat/Chaos","homepage":null,"size":3984,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"chaosbot:master","ref":"master","sha":"8e20dea5961d616075b1a500bd1e3de1e03cafe9","user":{"login":"chaosbot","id":28798182,"avatar_url":"https://avatars3.githubusercontent.com/u/28798182?v=3","gravatar_id":"","url":"https://api.github.com/users/chaosbot","html_url":"https://github.com/chaosbot","followers_url":"https://api.github.com/users/chaosbot/followers","following_url":"https://api.github.com/users/chaosbot/following{/other_user}","gists_url":"https://api.github.com/users/chaosbot/gists{/gist_id}","starred_url":"https://api.github.com/users/chaosbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaosbot/subscriptions","organizations_url":"https://api.github.com/users/chaosbot/orgs","repos_url":"https://api.github.com/users/chaosbot/repos","events_url":"https://api.github.com/users/chaosbot/events{/privacy}","received_events_url":"https://api.github.com/users/chaosbot/received_events","type":"User","site_admin":false},"repo":{"id":92091765,"name":"Chaos","full_name":"chaosbot/Chaos","owner":{"login":"chaosbot","id":28798182,"avatar_url":"https://avatars3.githubusercontent.com/u/28798182?v=3","gravatar_id":"","url":"https://api.github.com/users/chaosbot","html_url":"https://github.com/chaosbot","followers_url":"https://api.github.com/users/chaosbot/followers","following_url":"https://api.github.com/users/chaosbot/following{/other_user}","gists_url":"https://api.github.com/users/chaosbot/gists{/gist_id}","starred_url":"https://api.github.com/users/chaosbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaosbot/subscriptions","organizations_url":"https://api.github.com/users/chaosbot/orgs","repos_url":"https://api.github.com/users/chaosbot/repos","events_url":"https://api.github.com/users/chaosbot/events{/privacy}","received_events_url":"https://api.github.com/users/chaosbot/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chaosbot/Chaos","description":"A social coding experiment that updates its own code democratically. http://chaosthebot.com","fork":false,"url":"https://api.github.com/repos/chaosbot/Chaos","forks_url":"https://api.github.com/repos/chaosbot/Chaos/forks","keys_url":"https://api.github.com/repos/chaosbot/Chaos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chaosbot/Chaos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chaosbot/Chaos/teams","hooks_url":"https://api.github.com/repos/chaosbot/Chaos/hooks","issue_events_url":"https://api.github.com/repos/chaosbot/Chaos/issues/events{/number}","events_url":"https://api.github.com/repos/chaosbot/Chaos/events","assignees_url":"https://api.github.com/repos/chaosbot/Chaos/assignees{/user}","branches_url":"https://api.github.com/repos/chaosbot/Chaos/branches{/branch}","tags_url":"https://api.github.com/repos/chaosbot/Chaos/tags","blobs_url":"https://api.github.com/repos/chaosbot/Chaos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chaosbot/Chaos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chaosbot/Chaos/git/refs{/sha}","trees_url":"https://api.github.com/repos/chaosbot/Chaos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chaosbot/Chaos/statuses/{sha}","languages_url":"https://api.github.com/repos/chaosbot/Chaos/languages","stargazers_url":"https://api.github.com/repos/chaosbot/Chaos/stargazers","contributors_url":"https://api.github.com/repos/chaosbot/Chaos/contributors","subscribers_url":"https://api.github.com/repos/chaosbot/Chaos/subscribers","subscription_url":"https://api.github.com/repos/chaosbot/Chaos/subscription","commits_url":"https://api.github.com/repos/chaosbot/Chaos/commits{/sha}","git_commits_url":"https://api.github.com/repos/chaosbot/Chaos/git/commits{/sha}","comments_url":"https://api.github.com/repos/chaosbot/Chaos/comments{/number}","issue_comment_url":"https://api.github.com/repos/chaosbot/Chaos/issues/comments{/number}","contents_url":"https://api.github.com/repos/chaosbot/Chaos/contents/{+path}","compare_url":"https://api.github.com/repos/chaosbot/Chaos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chaosbot/Chaos/merges","archive_url":"https://api.github.com/repos/chaosbot/Chaos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chaosbot/Chaos/downloads","issues_url":"https://api.github.com/repos/chaosbot/Chaos/issues{/number}","pulls_url":"https://api.github.com/repos/chaosbot/Chaos/pulls{/number}","milestones_url":"https://api.github.com/repos/chaosbot/Chaos/milestones{/number}","notifications_url":"https://api.github.com/repos/chaosbot/Chaos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chaosbot/Chaos/labels{/name}","releases_url":"https://api.github.com/repos/chaosbot/Chaos/releases{/id}","deployments_url":"https://api.github.com/repos/chaosbot/Chaos/deployments","created_at":"2017-05-22T19:29:47Z","updated_at":"2017-05-26T03:26:26Z","pushed_at":"2017-05-26T03:02:01Z","git_url":"git://github.com/chaosbot/Chaos.git","ssh_url":"git@github.com:chaosbot/Chaos.git","clone_url":"https://github.com/chaosbot/Chaos.git","svn_url":"https://github.com/chaosbot/Chaos","homepage":"","size":3979,"stargazers_count":1786,"watchers_count":1786,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":214,"mirror_url":null,"open_issues_count":43,"forks":214,"open_issues":43,"watchers":1786,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chaosbot/Chaos/pulls/271"},"html":{"href":"https://github.com/chaosbot/Chaos/pull/271"},"issue":{"href":"https://api.github.com/repos/chaosbot/Chaos/issues/271"},"comments":{"href":"https://api.github.com/repos/chaosbot/Chaos/issues/271/comments"},"review_comments":{"href":"https://api.github.com/repos/chaosbot/Chaos/pulls/271/comments"},"review_comment":{"href":"https://api.github.com/repos/chaosbot/Chaos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chaosbot/Chaos/pulls/271/commits"},"statuses":{"href":"https://api.github.com/repos/chaosbot/Chaos/statuses/58ae2cdded86ef579ec87f12dca13ed48d93933a"}}}}
{"actor":{"display_login":"reddraggone9"}}