forked from github-tools/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelperFunctions.js
More file actions
43 lines (39 loc) · 1.16 KB
/
helperFunctions.js
File metadata and controls
43 lines (39 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
export function getNextPage(linksHeader = '') {
const links = linksHeader.split(/\s*,\s*/); // splits and strips the urls
return links.reduce(function(nextUrl, link) {
if (link.search(/rel="next"/) !== -1) {
return (link.match(/<(.*)>/) || [])[1];
}
return nextUrl;
}, undefined);
}
export function deleteRepo(repo, github) {
return github
.getRepo(repo.owner.login, repo.name)
.deleteRepo()
.then((removed) => {
if (removed) {
console.log(repo.full_name, 'deleted'); // eslint-disable-line
}
});
}
export function deleteTeam(team, github) {
return github
.getTeam(team.id)
.deleteTeam()
.then((removed) => {
if (removed) {
console.log('team', team.name, 'deleted'); //eslint-disable-line
}
});
}
export function deleteProject(project, github) {
return github
.getProject(project.id)
.deleteProject()
.then((removed) => {
if (removed) {
console.log('project', project.name, 'deleted'); //eslint-disable-line
}
});
}