Skip to content

Commit d4422af

Browse files
committed
allow configure shared projects for groups
1 parent 91b70bb commit d4422af

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ gitlab:
5757
url: "<gitlab api url>" # Gitlab API base url
5858
groups: # List of your project’s groups (optional if projects are defined)
5959
- id: 4 # Group id
60-
excluded: [1, 2, 3] # List of projects to exclude from the current group projects (optional)
6160
- id: 5
61+
excluded: [1, 2, 3] # List of projects to exclude from the current group projects (optional)
62+
- id: 6
63+
withShared: false # Whether to include shared projects or not, defaults to true
6264
projects: # List of your project (optional if groups are defined)
6365
- id: 42 # Project id
6466
paths: # List of paths that should be changed in merge requests

api/GitLab.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ class GitLab {
3333
return this.__getPaginated(uri, query)
3434
}
3535

36-
groupProjects = group => {
36+
groupProjects = (group, { withShared }) => {
3737
const uri = this.__getUrl("groups", group, "projects")
38-
return this.__getPaginated(uri)
38+
const query = { with_shared: withShared }
39+
40+
return this.__getPaginated(uri, query)
3941
.then(projects => projects.map(project => project.id))
4042
}
4143

gbot.example.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ gitlab:
1818
- id: 44
1919
groups:
2020
- id: 4
21-
excluded: [1, 2, 3]
2221
- id: 5
23-
excluded: [11, 12]
22+
excluded: [1, 2, 3]
2423
- id: 6
24+
withShared: false
2525

2626
# tasks config
2727
unapproved:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cadolabs/gbot",
3-
"version": "2.3.2",
3+
"version": "2.4.0",
44
"bin": "gbot",
55
"repository": "https://github.com/Cado-Labs/gbot",
66
"author": "Aleksei Bespalov <nulldefiner@gmail.com>",

tasks/BaseCommand.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class BaseCommand {
2727

2828
if (_.isEmpty(groups)) return Promise.resolve(configProjects)
2929

30-
const promises = groups.map(({ id, excluded = [] }) => (
31-
this.gitlab.groupProjects(id).then(groupProjects => (
30+
const promises = groups.map(({ id, withShared = true, excluded = [] }) => (
31+
this.gitlab.groupProjects(id, { withShared }).then(groupProjects => (
3232
groupProjects.filter(p => !excluded.includes(p))
3333
))
3434
))

0 commit comments

Comments
 (0)