0% found this document useful (0 votes)
76 views3 pages

NSquared Backend Coding Challenge

Uploaded by

karlloutfi3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views3 pages

NSquared Backend Coding Challenge

Uploaded by

karlloutfi3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Project: Pull Request Monitor

Project Objective
Build a small Laravel application that fetches a few pieces of data from the free/public Github
API about the status of pull requests on a repository. Why would we need this? In a busy
project, it’s easy for pull requests to get lost or forgotten. In the effort to fix issues faster and
deploy releases more frequently, this tool would help us proactively monitor code repositories
through automation!

The end result should be a simple text file for each of the goals, each file including a list of
the pull requests affected (PR#, PR title, PR URL, etc).
For example 1-old-pull-requests.txt, 2-review-required-pull-requests.txt, etc.

Please provide a screen recording reviewing and talking through the code that you wrote,
any issues you encountered/overcame, a quick demo of it running and inserting into a
Google Sheet, and what you would do next if you had more time to take this project all
the way to production. Please also include a link to your github repository for the project

Note: If you’re not able to complete the project fully, just let u s know how far you get and
communicate the issues you discovered while building this. Communication is just as important
as the end result.

Project Goals
Fetch info about pull requests on a public repository:
https://github.com/woocommerce/woocommerce/pulls

Relevant documentation:
https://docs.github.com/en/rest/pulls/pulls#list-pull-requests

Also note: Github pull requests share some schema with github issues, so some of the
data/querying you need might be in the “issues” endpoint (it also applies to pull requests):
https://docs.github.com/en/rest/issues

1. List of all open pull requests created more than 14 days ago
Relevant documentation:
https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-request
s#search-by-when-an-issue-or-pull-request-was-created-or-last-updated

2. List of all open pull requests with a review required:


https://github.com/woocommerce/woocommerce/pulls?q=is%3Apr+is%3Aopen+review%3Arequ
ired
Relevant documentation:
https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-request
s#search-by-pull-request-review-status-and-reviewer

https://docs.github.com/en/rest/pulls/review-requests

3. List of all open pull requests where review status is `success`:


https://github.com/woocommerce/woocommerce/pulls?q=is%3Apr+is%3Aopen+status%3Asucc
ess
Relevant documentation:
https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-request
s#search-by-commit-status

4. List of all open pull requests with no reviews requested (no assigned reviewers)
We usually require a code review before something gets merged in, but sometimes we end up
with a PR where nobody is assigned so it just gets lost.

Error Handling and Scalability


It’s important to have robust error handling in any application, especially one that interacts with
3rd party APIs. Please describe how you’re proactively anticipating/handling errors like API rate
limits, dealing with unexpected responses, or managing network connection issues.

Please consider how you would make this more scalable if this were to be a production
application. How would you make sure it ran in production reliably every 15 minutes? How
would you make it automatically scan, not one, but rather thousands of different public
repositories on github every 15 minutes? What changes would you make to your code and how
would you configure your production environment?
Bonus Goal
Outputting the results to a text file shows sufficient use of the Github API. If you want to go one
step further, you could push this data directly into Google Sheets using Google’s API! This is not
strictly necessary, but if you’re enjoying the project and want to push forward to take the next
logical step, we’d want the results of these queries output into a Google Sheet for easy review.

Google Sheets Resources


Google Sheets API / Laravel Connector (simpler 3rd party library for doing basic insertion
into Google Sheets)
* https://github.com/kawax/laravel-google-sheets
* https://medium.com/nonstopio/google-sheet-integration-in-laravel-924fd89f9b44

Official Google PHP SDK (the official library, more fully featured but possibly more
cumbersome to set up)
https://github.com/googleapis/google-api-php-client

If you enjoy this project way too much and want


to continue iterating on it…
You could download the community edition of Airbyte and use it to sync all pull request data
from Github to a local MySQL database or CSV file. Airbyte is a free open-source business
intelligence ETL tool. It runs in a Docker container you can spin up locally on your laptop. Here
are some relevant links if you’re curious in playing around with it:

https://github.com/airbytehq/airbyte
https://airbyte.com/connectors/github
https://docs.airbyte.com/integrations/sources/github/
https://docs.airbyte.com/integrations/destinations/mysql
https://airbyte.com/connectors/local-csv

You might also like