CSC517 Fall 2017 OSS M1705: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 15: Line 15:


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


Tool # 1: JSON Author File   
Tool # 1: JSON Author File   
Line 32: Line 32:
   * On line # 13 - define the username of the git account user
   * 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
   * 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.




Line 41: Line 39:
  cd ToolRepository
  cd ToolRepository
  npm install
  npm install
 
As we are familiar with GitHub APIs and JSON, we will next be creating tool to report new contributors for particular pull request. 
To achieve this, we will be doing following steps :
* make the initialization tool support stopping at a particular date or commit
* create a tool that processes all of the closed pull requests for a github organization during a particular time period
** for each pull request, get the list of commits present
** for each commit, get the author/committer present
** if the author is not known, add it to the list of new contributors
** return the list of new contributors with names and links to github profiles
** update the JSON file containing known authors
*create unit tests mocking the github API usage validating the behaviour of the tool


==Design Patterns==
==Design Patterns==

Revision as of 23:23, 31 March 2017

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 initial 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


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

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

To achieve this, we will be doing following steps :

  • make the initialization tool support stopping at a particular date or commit
  • create a tool that processes all of the closed pull requests for a github organization during a particular time period
    • for each pull request, get the list of commits present
    • for each commit, get the author/committer present
    • if the author is not known, add it to the list of new contributors
    • return the list of new contributors with names and links to github profiles
    • update the JSON file containing known authors
  • create unit tests mocking the github API usage validating the behaviour of the tool

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/>