-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create new branch for user to push to #6
Comments
Check it out! You can also use this endpoint {
"permission": "write",
"user": {
"login": "ckingbailey",
"id": 20404311,
"node_id": "MDQ6VXNlcjIwNDA0MzEx",
"avatar_url": "https://avatars3.githubusercontent.com/u/20404311?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ckingbailey",
"html_url": "https://github.com/ckingbailey",
"followers_url": "https://api.github.com/users/ckingbailey/followers",
"following_url": "https://api.github.com/users/ckingbailey/following{/other_user}",
"gists_url": "https://api.github.com/users/ckingbailey/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ckingbailey/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ckingbailey/subscriptions",
"organizations_url": "https://api.github.com/users/ckingbailey/orgs",
"repos_url": "https://api.github.com/users/ckingbailey/repos",
"events_url": "https://api.github.com/users/ckingbailey/events{/privacy}",
"received_events_url": "https://api.github.com/users/ckingbailey/received_events",
"type": "User",
"site_admin": false
}
} |
/user response, which gets authenticated user, looks like:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After user is authenticated, try to create a new branch on the target repo. The app will push to this branch on user's behalf.
Get the SHA of master branch*
GET
https://api.github.com/repos/:USER/:REPO/git/ref/heads/master
Start new branch off master
POST
https://api.github.com/repos/:USER/:REPO/git/refs
, body:Gist here
Note that this endpoint only accepts JSON, and some kind of special GitHub JSON
application/vnd.github+json
. Docs here https://developer.github.com/v3/git/refs/You'll get back a response like
Hold onto that SHA. You'll need it to push the publiccode.yml to our new branch.
If you get a "403 Forbidden" or the like then the user doesn't have sufficient permissions on the target repo. I haven't tried this on a repo I don't have access to yet so I don't know what exactly that response will look like. If the user lacks permissions then we resort to strategies outlined in issue #3
* If repo has no master branch, or is not called master branch, that's too complicated for this app to handle at this point
The text was updated successfully, but these errors were encountered: