This simple Swift app uses the Github API (via OctoKit) to fetch the 100 most starred repositories on Github and display the top contributor of each. To do so, it does the following:
- Uses the search API to fetch the most starred repositories with the request: https://api.github.com/search/repositories?q=stars:>0&sort=stars&per_page=100
- For each repository, fetches the top contributors with: https://api.github.com/repos/:owner/:repo/contributors
- This project uses a fork of the Objective-C OctoKit because
- There is no podspec for version 0.7.7, which includes the search functionality
- No one had previously written support for fetching contributors for a particular repository.
- Because this app fires off requests to get contributors for every repository returned in the initial repository search request, we need to use authentication so that we can make more than 60 requests per hour (there are 101 requests used to display the data in this app).
To fetch the code:
- Run
git clone [email protected]:rrbrambley/starred-github-repos.git
- Run
pod install
from the root of the StarredGithubRepos Xcode project. - Open
StarredGithubRepos.xcworkspace
in Xcode
The client ID and secret are stored in a Secrets.plist
file in the Xcode project, which is not committed to this repository. Following these instructions to add your own client ID and secret:
- To get a client ID and client Secret, register an application at https://github.com/settings/applications/new
- Create a
Secrets.plist
file at the root of theStarredGithubRepos
group in the Xcode project. - Add the keys
GithubClientID
andGithubClientSecret
to the plist, with values from your newly created application on Github (from step 1)