support for gitlab and github internal visibility

This commit is contained in:
Brad Rydzewski 2020-12-18 13:59:16 -05:00
parent 6af2647e43
commit ba172461f4
5 changed files with 14 additions and 1 deletions

View file

@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [unreleased]
### Added
- support for repository-level concurrency limits.
- support for gitlab and github internal visibility on initial sync.
## [1.10.0]
### Added

2
go.mod
View file

@ -20,7 +20,7 @@ require (
github.com/drone/envsubst v1.0.3-0.20200709231038-aa43e1c1a629
github.com/drone/go-license v1.0.2
github.com/drone/go-login v1.0.4-0.20190311170324-2a4df4f242a2
github.com/drone/go-scm v1.7.2-0.20201111225713-c0438b46084b
github.com/drone/go-scm v1.8.0
github.com/drone/signal v1.0.0
github.com/dustin/go-humanize v1.0.0
github.com/go-chi/chi v3.3.3+incompatible

2
go.sum
View file

@ -106,6 +106,8 @@ github.com/drone/go-scm v1.7.2-0.20201028160627-427b8a85897c h1:3Dv6guONE4nry6fv
github.com/drone/go-scm v1.7.2-0.20201028160627-427b8a85897c/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
github.com/drone/go-scm v1.7.2-0.20201111225713-c0438b46084b h1:ivLeFPmHN+9sLMVAF7HvgvEglU5tzoqlzePLY5zKPo8=
github.com/drone/go-scm v1.7.2-0.20201111225713-c0438b46084b/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
github.com/drone/go-scm v1.8.0 h1:kDHu38a11loKf6uaBu75TmY1YPwsSaZdseET738Oy0o=
github.com/drone/go-scm v1.8.0/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
github.com/drone/signal v1.0.0 h1:NrnM2M/4yAuU/tXs6RP1a1ZfxnaHwYkd0kJurA1p6uI=
github.com/drone/signal v1.0.0/go.mod h1:S8t92eFT0g4WUgEc/LxG+LCuiskpMNsG0ajAMGnyZpc=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=

View file

@ -41,6 +41,12 @@ func convertRepository(src *scm.Repository, visibility string, trusted bool) *co
// convertVisibility is a helper function that returns the
// repository visibility based on the privacy flag.
func convertVisibility(src *scm.Repository, visibility string) string {
// if the visibility is set to internal (github enterprise and gitlab)
// and the global visibility is empty, automatically set to internal.
if visibility == "" && src.Visibility == scm.VisibilityInternal {
return core.VisibilityInternal
}
switch {
case src.Private == true:
return core.VisibilityPrivate

View file

@ -55,6 +55,10 @@ func TestConvertVisibility(t *testing.T) {
r: &scm.Repository{Private: true},
v: core.VisibilityPrivate,
},
{
r: &scm.Repository{Private: true, Visibility: scm.VisibilityInternal},
v: core.VisibilityInternal,
},
}
for i, test := range tests {