Skip to content

Commit

Permalink
Fixing requests/issues on pull request review
Browse files Browse the repository at this point in the history
  • Loading branch information
Lurian committed Nov 10, 2017
1 parent d6ba0df commit 3254229
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 22 deletions.
3 changes: 1 addition & 2 deletions app/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ gitlab:
-
Merge Request Hook
url:
token:
projects: []
token:
10 changes: 9 additions & 1 deletion app/gitlabService.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const conf = yaml.load(fs.readFileSync('config.yml'));
const gitlabUrl = conf.gitlab.url;
const gitlabToken = conf.gitlab.token;

/**
* Initiating GitLab api library with properties contained in the config.yml file.
*/
const GitlabAPI = require('node-gitlab-api')({
url: gitlabUrl,
token: gitlabToken
Expand All @@ -18,7 +21,8 @@ export const GitlabService = {
/**
* Verify the list of gitlab projects IDs and their MR List, warning users of
* MRs with merge problems.
* @param gitlabProjectsID List of gitlab projects IDs to be verified.
* @param gitlabProjectsID List of gitlab projects IDs to be verified. If the list
* is empty all the projects IDs are used. IDs acquired with the getAllProjectsID function.
*/
verifyAndWarnMRProblems: async function(gitlabProjectsID){
if(_.isEmpty(gitlabProjectsID)) gitlabProjectsID = await getAllProjectsID();
Expand All @@ -44,6 +48,10 @@ const getMergeRequestFromProject = async function (projectId) {
&& !MR.work_in_progress);
};

/**
* Gets all projects IDs using the GitLab API.
* @returns {Promise.<Array>} Array containing the project IDs
*/
const getAllProjectsID = async function () {
const projectsList = await GitlabAPI.projects.all();
return _.map(projectsList, (project) => project.id);
Expand Down
4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"slackbots": "1.0.2"
},
"dependencies": {
"lodash": "^4.17.4",
"node-gitlab-api": "^1.1.1"
"lodash": "4.17.x",
"node-gitlab-api": "1.1.x"
}
}
Loading

0 comments on commit 3254229

Please sign in to comment.