{"action":"created","issue":{"url":"https://api.github.com/repos/gitpoint/git-point/issues/50","repository_url":"https://api.github.com/repos/gitpoint/git-point","labels_url":"https://api.github.com/repos/gitpoint/git-point/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/gitpoint/git-point/issues/50/comments","events_url":"https://api.github.com/repos/gitpoint/git-point/issues/50/events","html_url":"https://github.com/gitpoint/git-point/pull/50","id":242879346,"number":50,"title":"Forking","user":{"login":"mikekavouras","id":627794,"avatar_url":"https://avatars5.githubusercontent.com/u/627794?v=4","gravatar_id":"","url":"https://api.github.com/users/mikekavouras","html_url":"https://github.com/mikekavouras","followers_url":"https://api.github.com/users/mikekavouras/followers","following_url":"https://api.github.com/users/mikekavouras/following{/other_user}","gists_url":"https://api.github.com/users/mikekavouras/gists{/gist_id}","starred_url":"https://api.github.com/users/mikekavouras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikekavouras/subscriptions","organizations_url":"https://api.github.com/users/mikekavouras/orgs","repos_url":"https://api.github.com/users/mikekavouras/repos","events_url":"https://api.github.com/users/mikekavouras/events{/privacy}","received_events_url":"https://api.github.com/users/mikekavouras/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-14T02:20:57Z","updated_at":"2017-07-14T04:09:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/gitpoint/git-point/pulls/50","html_url":"https://github.com/gitpoint/git-point/pull/50","diff_url":"https://github.com/gitpoint/git-point/pull/50.diff","patch_url":"https://github.com/gitpoint/git-point/pull/50.patch"},"body":"Introducing forking 🍴 (closes #41)\r\n\r\n![forking](https://user-images.githubusercontent.com/627794/28195268-e06c6b2e-680e-11e7-9829-271b059510cd.gif)\r\n\r\n## Behavior\r\n* The \"fork\" option will always be present on someone else's repo.\r\n* The repo will be forked to a user's personal account (can be expanded to support a user's organizations in another PR)\r\n\r\n# Notes (of disappointment) \r\nGitHub API does not provide enough information to infer whether or not a user has forked a repo based on some origin repo.\r\n\r\n### Attempt 1\r\n**Repository Search**\r\n`https://api.github.com/search/repositories?q=react-native%20user%3Amikekavouras%20fork%3Aonly%20in%3Aname`\r\n\r\nThe response object does not contain _any_ reference to the origin repo, so there's no way to tell exactly where this repository began.\r\n\r\n### Attempt 2 \r\n**User Repositories**  \r\n`https://api.github.com/repos/${username}/${repo.name}`  \r\n\r\nThis solution assumes that the repo names are the same, which is an inaccurate assumption. If a user has a conflicting repo name, GitHub will automatically append a `-n` to the forked repo (e.g. `react-native-1`).\r\n\r\nIf there is something I overlooked, please feel free to collaborate.\r\n\r\n## One more thing...\r\n\r\nIssue #3 is more pronounced with this PR because of navigation from repo screen to repo screen. Navigating back will *not* reload the previous repository state. This is outside the scope of this PR."},"comment":{"url":"https://api.github.com/repos/gitpoint/git-point/issues/comments/315264851","html_url":"https://github.com/gitpoint/git-point/pull/50#issuecomment-315264851","issue_url":"https://api.github.com/repos/gitpoint/git-point/issues/50","id":315264851,"user":{"login":"mikekavouras","id":627794,"avatar_url":"https://avatars5.githubusercontent.com/u/627794?v=4","gravatar_id":"","url":"https://api.github.com/users/mikekavouras","html_url":"https://github.com/mikekavouras","followers_url":"https://api.github.com/users/mikekavouras/followers","following_url":"https://api.github.com/users/mikekavouras/following{/other_user}","gists_url":"https://api.github.com/users/mikekavouras/gists{/gist_id}","starred_url":"https://api.github.com/users/mikekavouras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikekavouras/subscriptions","organizations_url":"https://api.github.com/users/mikekavouras/orgs","repos_url":"https://api.github.com/users/mikekavouras/repos","events_url":"https://api.github.com/users/mikekavouras/events{/privacy}","received_events_url":"https://api.github.com/users/mikekavouras/received_events","type":"User","site_admin":false},"created_at":"2017-07-14T04:09:04Z","updated_at":"2017-07-14T04:09:04Z","body":">\"is there no simple way to know whether a user has already forked an existent repository?\"\r\n\r\nAs far as I can tell, the only reliable way to know if a user fork exists is to use `/repos/:owner/:repo/forks`. However, a repo like react-native has 11k+ forks meaning **350+ paged responses**. _Very impractical_. The best idea I can come up with is some idea of, \"where owner is ${user}\". Something like `/repos/:owner/:repo/forks?owner=username`. Sadly, nothing like that exists.\r\n\r\n\r\n>\"- does the call pass and the user is navigated to the repository normally?\"\r\n\r\nYes it does. GH essentially ignores the request and sends us back the already forked repo JSON. The server response is the same in both cases and the resolution on the front end is consistent. "}}
{"actor":{"display_login":"mikekavouras"}}