Skip to content

Commit

Permalink
[#2600] Bug/Add GH Repo
Browse files Browse the repository at this point in the history
- Resolved panic caused by different interfaces for gh-repo-input between v1 & v2

Signed-off-by: wanyaland <[email protected]>
  • Loading branch information
wanyaland committed Feb 10, 2021
1 parent af39ef3 commit 767ef64
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions cla-backend-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ github.com/communitybridge/easycla v1.0.99 h1:PkmkMV7cLH2Q2YNSFiGGmlyrHBXVYdsWMw
github.com/communitybridge/easycla v1.0.106 h1:NLYUZUZtp9DQ0dHEQkhz9h9EMzLRmuh9udsPZk8oLoQ=
github.com/communitybridge/easycla v1.0.107 h1:dktHAji1yJ1nMEu54z4paPWOM4Q7A9rryc0OCADfAcY=
github.com/communitybridge/easycla v1.0.117 h1:o+rdmcNgZeMQ/N8HV/d5apNIBrkYH7eyM9UUYnEzewo=
github.com/communitybridge/easycla v1.0.118 h1:8yrsOQ+ENUFi4RFl1krRlIxc51lzZNutidR+yy2HwW0=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
Expand Down
16 changes: 7 additions & 9 deletions cla-backend-go/v2/repositories/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"fmt"
"strconv"

"github.com/jinzhu/copier"
"github.com/sirupsen/logrus"

"github.com/go-openapi/swag"
Expand Down Expand Up @@ -142,16 +141,15 @@ func (s *service) AddGithubRepository(ctx context.Context, projectSFID string, i
if existingRepositoryModel != nil && !existingRepositoryModel.Enabled {
msg := fmt.Sprintf("Github repository : %s disabled and shall get re-enabled... ", utils.StringValue(ghRepo.FullName))
log.WithFields(f).Debug(msg)
var v1Input v1Models.GithubRepositoryInput
err := copier.Copy(&v1Input, &input)
if err != nil {
log.WithFields(f).Error("unable to create v1GithubRepository input")
return nil, err
enabled := true
v1Input := &v1Models.GithubRepositoryInput{
Enabled: &enabled,
RepositoryProjectID: input.ClaGroupID,
RepositoryOrganizationName: input.GithubOrganizationName,
}
// Enabled repository
*v1Input.Enabled = true

// Update Repo details in case of any changes
updatedRepository, updateErr := s.repo.UpdateGithubRepository(ctx, existingRepositoryModel.RepositoryID, &v1Input)
updatedRepository, updateErr := s.repo.UpdateGithubRepository(ctx, existingRepositoryModel.RepositoryID, v1Input)
if updateErr != nil {
return nil, updateErr
}
Expand Down

0 comments on commit 767ef64

Please sign in to comment.