github-api
How to create a commit and push into repo with GitHub API v3?
Solution using the requests library: NOTES: I use the requests library to do the calls to GitHub REST API v3. 1. Get the last commit SHA of a specific branch # GET /repos/:owner/:repo/branches/:branch_name last_commit_sha = response.json()[‘commit’][‘sha’] 2. Create the blobs with the file’s content (encoding base64 or utf-8) # POST /repos/:owner/:repo/git/blobs # { # “content”: … Read more
How can I get a list of all pull requests for a repo through the github API?
You can get all pull requests (closed, opened, merged) through the variable state. Just set state=all in the GET query, like this-> https://api.github.com/repos/:owner/:repo/pulls?state=all For more info: check the Parameters table at https://developer.github.com/v3/pulls/#list-pull-requests Edit: As per Tomáš Votruba’s comment: the default value for, “per_page=30”. The maximum is per_page=100. To get more than 100 results, you need … Read more
How do I generate the GitHub OAuth token for organization accounts?
That’s not possible currently, you can only create tokens for user accounts since user accounts have permissions associated with them (organizations don’t). So, you’d need to create a token with an account which has access to the repository in question and give that to Travis. You can also create a machine account for that purpose.
How to delete my follower at github?
Removing a follower on Github in fact is possible with this workaround: Block the user who watches you, as described in the github help. Then unblock him again. After that he will not be blocked anymore and he will also no longer follow you.
How to parse link header from github API
The parse-link-header NPM module exists for this purpose; its source can be found on github under a MIT license (free for commercial use). Installation is as simple as: npm install parse-link-header Usage looks like the following: var parse = require(‘parse-link-header’); var parsed = parse(‘<https://api.github.com/repos?page=3&per_page=100>; rel=”next”, <https://api.github.com/repos?page=50&per_page=100>; rel=”last”‘) …after which one has parsed.next, parsed.last, etc: { … Read more
Is there a URL query string for searching own GitHub Gists?
Try searching with user:<username> hello world. E.g. https://gist.github.com/search?q=user%3Adefunkt+hello+world
Get github username by id
We need to do this on Gitter to deal with the situation where a user has changed their username on GitHub and we get a 404 response when querying their old username. Here’s an undocumented endpoint, so use as your own peril, but it does work for now. Use the endpoint: https://api.github.com/user/:id, where :id is … Read more
Create comment on pull request
Yes, it is possible. The section of the API docs you are referencing relates to line comments (comments on specific lines of the commits in the pull req), and the docs say: Pull Request Review Comments are comments on a portion of the unified diff. These are separate from Commit Comments (which are applied directly … Read more
Intuitive way to view most active fork in GitHub
I don’t know of one, but you could probably write one easily given the breadth of API wrappers out there. An example with github3.py would be import github3 r = github3.repository(‘owner’, ‘repo_name’) most_watched = next(r.iter_forks(sort=”watchers”, number=1)) As best I know, you cannot sort on stars and repositories don’t have that information returned to them. You … Read more