A simple node application that interacts with the GitHub Rest API. It retrieves all the Pull requests from all the repositories for a particular organization (specified in the .env file). Then groups the PR's into week over week merges etc.
This shows an example of how to use async / await
in a for loop
. Shows example of how you might structure a node application.
- Clone the repository
git clone [email protected]:Perry5/https://github.com/Perry5/analyze-github-prs-for-organization.git
- Install dependencies
cd analyze-github-prs-for-organization
npm install
- Set environment (vars):
cp .env.example .env
- Run the project
npm start
- Using Curl, Postman or your favorite tool, make a GET request to:
localhost:8080/prs
make sure you watch the sever logs
- Default URL for the GitHub REST API v3
- GitHub Organization to query
-
Requests that return multiple items will be paginated to 30 items by default. We can set a custom page size up to 100.
-
NOTE: If you enter any value < 30 it will default to 30 (min) and if you enter any value > 100 it will default to 100 (max)
Higher per-page limits seem to run a bit faster. On my machine:
PER_PAGE_LIMIT = 30
- Takes an average of 54 seconds to retrieve all the PRs from all the reposPER_PAGE_LIMIT = 100
- Takes an average of 44 seconds to retrieve all the PRs from all the repos
- Registered GitHub application Client Secret and ID used in this case to increasing the unauthenticated rate limit. If specified, it allows requests up to 5000 per hour. If not specified, requests are limited to 60 per hour.
Simple console.log() is used for displaying output on the server. In order to get a sense of what is happening with the server, we log some outputs to the console. In a real environment, a logging tool like winston will be used.