Skip to content

Commit

Permalink
options: Fix publish results logic
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Augustus <foo@auggie.dev>
  • Loading branch information
justaugustus committed Feb 28, 2022
1 parent d4bc1bc commit 07e5f8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion entrypoint/entrypoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,11 @@ func TestUpdateEnvVariables(t *testing.T) {
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
tt.opts.SetRepoVisibility(tt.isPrivateRepo)
tt.opts.SetPublishResults()
if !tt.wantErr && tt.isPrivateRepo {
if tt.opts.ScorecardPublishResults != "false" {
t.Errorf("scorecardPublishResults env var should be false")
t.Errorf("scorecardPublishResults env var (%s) should be false", tt.opts.ScorecardPublishResults)
}
}

Expand Down
6 changes: 3 additions & 3 deletions options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ func (o *Options) SetDefaultBranch(defaultBranch string) error {
// repository's visibility.
func (o *Options) SetPublishResults() {
isPrivateRepo := o.RepoVisibility
if isPrivateRepo == "" {
if isPrivateRepo == "true" || isPrivateRepo == "" {
o.ScorecardPublishResults = "false"
} else {
o.ScorecardPublishResults = "true"
}

o.ScorecardPublishResults = isPrivateRepo
}

// GetGithubToken retrieves the GitHub auth token from the environment.
Expand Down

0 comments on commit 07e5f8d

Please sign in to comment.