@@ -15,31 +15,33 @@ import (
15
15
"golang.org/x/exp/slices"
16
16
17
17
"dario.cat/mergo"
18
- ll "github.com/ewen-lbh/label-logger-go"
19
18
"github.com/google/uuid"
19
+ ll "github.com/gwennlbh/label-logger-go"
20
20
"github.com/invopop/jsonschema"
21
21
"github.com/joho/godotenv"
22
22
"gopkg.in/yaml.v3"
23
23
)
24
24
25
25
type MirrorDefaults struct {
26
- Except []string `json:"except,omitempty"`
27
- Only []string `json:"only,omitempty"`
28
- Prefix string `json:"prefix,omitempty"`
29
- Suffix string `json:"suffix,omitempty"`
30
- Topics []string `json:"topics,omitempty"`
26
+ Except []string `json:"except,omitempty"`
27
+ Only []string `json:"only,omitempty"`
28
+ Prefix string `json:"prefix,omitempty"`
29
+ Suffix string `json:"suffix,omitempty"`
30
+ Topics []string `json:"topics,omitempty"`
31
+ Renames map [string ]string `json:"renames,omitempty"`
31
32
Subgroups struct {
32
33
Flatten string `json:"flatten"`
33
34
} `json:"subgroups,omitempty"`
34
35
}
35
36
36
37
type MirrorDefinition struct {
37
- From string `json:"from"`
38
- Except []string `json:"except,omitempty"`
39
- Only []string `json:"only,omitempty"`
40
- Prefix string `json:"prefix,omitempty"`
41
- Suffix string `json:"suffix,omitempty"`
42
- Topics []string `json:"topics,omitempty"`
38
+ From string `json:"from"`
39
+ Except []string `json:"except,omitempty"`
40
+ Only []string `json:"only,omitempty"`
41
+ Prefix string `json:"prefix,omitempty"`
42
+ Suffix string `json:"suffix,omitempty"`
43
+ Topics []string `json:"topics,omitempty"`
44
+ Renames map [string ]string `json:"renames,omitempty"`
43
45
Subgroups struct {
44
46
Flatten string `json:"flatten"`
45
47
} `json:"subgroups,omitempty"`
@@ -154,6 +156,7 @@ func githubOrgConfig(org string) ([]MirrorDefinition, bool) {
154
156
Suffix : config .Defaults .Suffix ,
155
157
Topics : config .Defaults .Topics ,
156
158
Subgroups : config .Defaults .Subgroups ,
159
+ Renames : config .Defaults .Renames ,
157
160
})
158
161
}
159
162
return merged , true
@@ -401,6 +404,12 @@ func setGitLabMirror(repo map[string]interface{}, githubName string, githubOrg s
401
404
func githubNameFromGitlabPath (path string , mirrorConfigUsed MirrorDefinition ) string {
402
405
pathParts := strings .Split (path , "/" )[1 :]
403
406
path = strings .Join (pathParts , mirrorConfigUsed .Subgroups .Flatten )
407
+ for from , to := range mirrorConfigUsed .Renames {
408
+ if from == path {
409
+ path = to
410
+ break
411
+ }
412
+ }
404
413
path = fmt .Sprintf ("%s%s%s" , mirrorConfigUsed .Prefix , path , mirrorConfigUsed .Suffix )
405
414
return path
406
415
}
0 commit comments