Skip to content

Commit

Permalink
Fix some diffs between Golang and current action (#431)
Browse files Browse the repository at this point in the history
Co-authored-by: Azeem Shaikh <azeems@google.com>
  • Loading branch information
azeemshaikh38 and azeemsgoogle committed Jun 8, 2022
1 parent 7ab69b4 commit 80c928c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
LDFLAGS=-w -extldflags
# NOTE: Keep this in sync with go.mod for ossf/scorecard.
LDFLAGS=-X sigs.k8s.io/release-utils/version.gitVersion=v4.3.1 -X sigs.k8s.io/release-utils/version.gitCommit=70d045b9ef00e7171ce3950aca38eef6ea4d7308 -w -extldflags \"-static\"

build: ## Runs go build on repo
# Run go build and generate scorecard executable
Expand Down
13 changes: 7 additions & 6 deletions options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/caarlos0/env/v6"

"github.com/ossf/scorecard-action/github"
"github.com/ossf/scorecard/v4/options"
scopts "github.com/ossf/scorecard/v4/options"
)

var (
Expand All @@ -41,7 +41,7 @@ var (
// Options are options for running scorecard via GitHub Actions.
type Options struct {
// Scorecard options.
ScorecardOpts *options.Options
ScorecardOpts *scopts.Options

// Scorecard command-line options.
EnabledChecks string `env:"ENABLED_CHECKS"`
Expand Down Expand Up @@ -74,21 +74,22 @@ type Options struct {

const (
defaultScorecardPolicyFile = "/policy.yml"
formatSarif = options.FormatSarif
formatSarif = scopts.FormatSarif
)

// New creates a new options set for running scorecard via GitHub Actions.
func New() (*Options, error) {
// Enable scorecard command to use SARIF format.
os.Setenv(options.EnvVarEnableSarif, trueStr)
os.Setenv(scopts.EnvVarEnableSarif, trueStr)

opts := &Options{
ScorecardOpts: options.New(),
ScorecardOpts: scopts.New(),
}
if err := env.Parse(opts); err != nil {
return opts, fmt.Errorf("parsing entrypoint env vars: %w", err)
}

opts.ScorecardOpts.ShowDetails = true
// This section restores functionality that was removed in
// https://github.com/ossf/scorecard/pull/1898.
// TODO(options): Consider moving this to its own function.
Expand Down Expand Up @@ -116,7 +117,7 @@ func New() (*Options, error) {
}

// TODO(scorecard): Reset commit options. Fix this in scorecard.
opts.ScorecardOpts.Commit = options.DefaultCommit
opts.ScorecardOpts.Commit = scopts.DefaultCommit

if err := opts.ScorecardOpts.Validate(); err != nil {
return opts, fmt.Errorf("validating scorecard options: %w", err)
Expand Down

0 comments on commit 80c928c

Please sign in to comment.