CSC517 Fall 2017 OSS M1705

From Expertiza_Wiki
Jump to navigation Jump to search

M1705 - Automatically report new contributors to all git repositories

Introduction

Servo<ref>https://en.wikipedia.org/wiki/Servo_(layout_engine)</ref> is a browser layout engine developed by Mozilla<ref>https://en.wikipedia.org/wiki/Mozilla</ref>. It is at its early stage but can easily supply i.e. contribute to Wikipedia and Github<ref>https://en.wikipedia.org/wiki/GitHub</ref> successfully passes the Acid2<ref>https://en.wikipedia.org/wiki/Acid2</ref> test. It aims to create the parallel environment with different components which can be handled by small separate tasks.

We are listing down new contributors to the servo/servo repository. We have to solve the issue of tracking the information across all the repositories in the servo organization. The final goal of this work is to build a system using the Github API to determine this information on a regular basis.

Scope

The scope of the project was to complete the following steps:

- create a GitHub organization with several repositories that can be used for manual tests
- create a tool that initializes a JSON file with the known authors for a local git repository
- create a tool that clones every git repository in a given GitHub organization (use the GitHub API to retrieve this information)

Project Description

The target of our project is to get familiar with GitHub APIs and JSON. Thus, we created following tools:

Tool # 1: JSON Author File

Create a tool that initializes a JSON file with the known authors for a local git repository

  • First, it fetches the author name from all the commits in a repository
  • Then, adds them to set. Here we are using set to avoid the duplication of authors if s/he has done more than 1 commit.
  • Saves the set in a JSON file.

Tool # 2: Clone Repositories Tool

Create a tool that clones every git repository in a given GitHub organization (use the GitHub API to retrieve this information)

  • `package.json` has the dependencies needed to run both the tools.
  • `gitApi.js` - clones the all the repositories in the given organization inside `./tmp` folder
 * On line # 12 - define the GITAPI token as environment variable `GITHUB_KEY` **check references below for token**
 * On line # 13 - define the username of the git account user
 * On line # 18 - define the organization of interest from where repositories need to be cloned

As we are familiar with GitHub APIs and JSON, we will next be creating tool to report new contributors for particular pull request.


git clone https://github.com/OODD-Mozilla/ToolRepository.git
cd ToolRepository
npm install

Design Patterns

Design patterns are not applicable as our task involved is just implementing a way to get all the contributors in a git repository. However, the [Project Description](https://github.com/OODD-Mozilla/ToolRepository/blob/master/Wiki.md#project-description) section below provides details of the steps as the way it was implemented.

Conclusion

After understanding the GitHub API and the way JSON object can be used to access and post the data of the new contributors in the repository we have observed it can be automated and the steps to understand it are as shown in the article.

References

<references/>