Skip to content

Commit

Permalink
✨ Gitlab support (ossf#2265)
Browse files Browse the repository at this point in the history
* updated readme to reflect gitlab usage

* bugfixes after a good deal of testing

* removed unnecessary files from branch

* cleaning up my mess

* requested changes + unit tests

* style fixes

* updated readme to reflect gitlab usage

* bugfixes after a good deal of testing

* removed unnecessary files from branch

* cleaning up my mess

* requested changes + unit tests

* style fixes

* merge main into gitlab_support

* check-linter fixes

Signed-off-by: Nathaniel Wert <[email protected]>
Co-authored-by: nathaniel.wert <[email protected]>
Signed-off-by: N8BWert <[email protected]>
Signed-off-by: nathaniel.wert <[email protected]>
  • Loading branch information
N8BWert and nathaniel.wert committed Nov 28, 2022
1 parent 08f8007 commit 8969370
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions clients/gitlabrepo/branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func (handler *branchesHandler) init(repourl *repoURL) {
handler.once = new(sync.Once)
}

// nolint: nestif
func (handler *branchesHandler) setup() error {
handler.once.Do(func() {
if !strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) {
Expand Down Expand Up @@ -225,10 +226,9 @@ func makeBranchRefFrom(branch *gitlab.Branch, protectedBranch *gitlab.ProtectedB
projectApprovalRule *gitlab.ProjectApprovals,
) *clients.BranchRef {
requiresStatusChecks := newFalse()
if projectStatusChecks != nil {
if len(projectStatusChecks) > 0 {
requiresStatusChecks = newTrue()
}

if len(projectStatusChecks) > 0 {
requiresStatusChecks = newTrue()
}

statusChecksRule := clients.StatusChecksRule{
Expand Down
1 change: 1 addition & 0 deletions clients/gitlabrepo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ func (client *Client) InitRepo(inputRepo clients.Repo, commitSHA string) error {

// Init tarballHandler.
client.tarball.init(client.ctx, client.repourl, client.repo, commitSHA)

return nil
}

Expand Down
1 change: 1 addition & 0 deletions clients/gitlabrepo/commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func (handler *commitsHandler) init(repourl *repoURL) {
handler.once = new(sync.Once)
}

// nolint: gocognit
func (handler *commitsHandler) setup() error {
handler.once.Do(func() {
commits, _, err := handler.glClient.Commits.ListCommits(handler.repourl.projectID, &gitlab.ListCommitsOptions{})
Expand Down

0 comments on commit 8969370

Please sign in to comment.