Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsimon committed May 4, 2022
1 parent ac7232a commit 683a44a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions checks/remediations.go
Expand Up @@ -25,9 +25,10 @@ import (
)

var (
remediationBranch string
remediationRepo string
remediationOnce *sync.Once
remediationBranch string
remediationRepo string
remediationOnce *sync.Once
remediationSetupErr error
)

//nolint:gochecknoinits
Expand All @@ -36,26 +37,26 @@ func init() {
}

func remdiationSetup(c *checker.CheckRequest) error {
var setupErr error
remediationOnce.Do(func() {
// Get the branch for remediation.
b, err := c.RepoClient.GetDefaultBranch()
if err != nil && !errors.Is(err, clients.ErrUnsupportedFeature) {
setupErr = err
remediationSetupErr = err
return
}
if b.Name != nil {
remediationBranch = *b.Name
uri := c.Repo.URI()
parts := strings.Split(uri, "/")
if len(parts) != 3 {
setupErr = fmt.Errorf("%w: %s", errInvalidArgLength, uri)
remediationSetupErr = fmt.Errorf("%w: %s", errInvalidArgLength, uri)
return
}
remediationRepo = fmt.Sprintf("%s/%s", parts[1], parts[2])
}
})
return setupErr

return remediationSetupErr
}

func createWorkflowPermissionRemediation(filepath string) *checker.Remediation {
Expand Down

0 comments on commit 683a44a

Please sign in to comment.