Closed akarsh closed 7 years ago
I was able to solve the issue by creating a function getGitLabBranches
Here is the working code for this function
// Global variables
var storeProjectId; // Project Id
var storeBranches = []; //Branches
// Listing projects
gitlab.projects.all(function (projects) {
var i, len, project;
for (i = 0, len = projects.length; i < len; i++) {
project = projects[i];
storeProjectId = project.id;
getGitLabBranches(storeProjectId);
return storeProjectId;
}
});
// Listing branches based on project id
function getGitLabBranches(storeProjectId) {
gitlab.projects.repository.listBranches(storeProjectId, function (branches) {
for (var k = 0; k < branches.length; k++) {
obj = branches[k];
storeBranches.push(obj.name);
}
})
}
Hi,
Can you please provide some example on how to fetch branches for a project. I am trying but the console output is not giving me what i was looking.
gitlab.projects.repository.listBranches(1)
Thank you