Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

GDGVIT/gdginfo-backend

Repository files navigation

github-orgs-api


For calculating score of all members of any github organisation and top contributors of all repositories.

view original docs


Some features

  • GitHub Graph API
  • Interchangable organization leaderboard
  • Top contributors for organizations
  • Repository specific metadata for organizations
  • Pluggable caching layer
  • Automatic Scheduled cache update
  • Manual cache update
  • GitHub Oauth
  • Repository specific analysis
  • Cache refresh for repo specific analysis

Getting Started

You can use this application easily just by changing the following credentials..

  • Redis server url (optional)
  • Name of the organization
  • Github api key

This project uses .env. To configure, simply make a file named .env in the root of your project and add the following lines to it.

ORGANIZATION=<Name of the organization as specified in GitHub>
REDIS_URL=<your redis url>
GITHUB_CLIENT_ID=<your-id>
GITHUB_CLIENT_SECRET=<your-secret>
TOKEN=<your-github-personal-access-token>

How to use

Clone the repository and add the above credentials.

# Clone the repo
$ git clone https://github.com/GDGVIT/gdginfo-backend.git

# Navigate into it
$ cd gdginfo-backend

# Bootstrap
$ make

Ways to run

  • Regular mode: run this if you do not want a caching layer in your application. Will drastically increase response time but save the cost of having a caching service
$ ./app

  • Caching mode: run this if you want a caching layer in your application. Will drastically decrease response latency.
$ ./app --with-cache

Clean

Uninstall all requirements that were installed while making this project.

$ make clean

Linting

Lint the code according to pep8 heuristics. Good for contributing

$ make lint

Generate docs

Generate documentation based on comment descriptions on the APIs. This uses apidoc and requires npm.

$ make docs

How it works

Algorithm: It uses github api and fetches the information about members, all the repositories in that organization, members contribution in those repository. The application scrolls through all the repositories that belong to this organization. and using that it calculates contribution a particular individual based on his contribution to that repository.

Action Weightage
stargazers count 10
watchers count 10
forks count 15
contributions 40

d[contributors['login']] += project[1] * 10 + project[2] * 5 +project[3] * 15 + contributors['contributions'] * 40

Caching: When the --with-cache flag is provided, all responses are served from a cache. This cache is updated daily. This significantly decreases response latency since github api provides only 10 requests per minute.


Limitations

  • Only 30 repositories can be fetched from the API at one time.
  • Only 10 requests can be made to the API per minute.

Mitigation

  • Pluggable caching layer
  • Manual cache seed
  • CRON-ed cache seed

Getting GitHub tokens and secrets

  • Go here and create a new github app with redirect URL as <Your base URL>/oauth. Your base and redirect URL can be localhost also. You'll get a client ID and client secret from here.

  • Now go here and create a personal access token with read access to everything. Here youll get your token.

  • Note: For heroku, the callback URL should be http

Built With

Contributors

  • Shubham Bhardwaj
  • Apurva Nitanjay
  • Angad Sharma

Made with ❤️ by DSC VIT