-
Notifications
You must be signed in to change notification settings - Fork 183
/
Copy pathsettings.js
35 lines (29 loc) · 926 Bytes
/
settings.js
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
class Settings {
static sync (github, repo, config) {
return new Settings(github, repo, config).update()
}
constructor (github, repo, config) {
this.github = github
this.repo = repo
this.config = config
}
update () {
return Promise.all(Object.entries(this.config).map(([section, config]) => {
const debug = { repo: this.repo }
debug[section] = config
const Plugin = Settings.PLUGINS[section]
return new Plugin(this.github, this.repo, config).sync()
}))
}
}
Settings.FILE_NAME = '.github/settings.yml'
Settings.PLUGINS = {
repository: require('./plugins/repository'),
autolinks: require('./plugins/autolinks'),
labels: require('./plugins/labels'),
collaborators: require('./plugins/collaborators'),
teams: require('./plugins/teams'),
milestones: require('./plugins/milestones'),
branches: require('./plugins/branches')
}
module.exports = Settings