Skip to content

Commit

Permalink
add input for specifying --file-mode
Browse files Browse the repository at this point in the history
ossf/scorecard#4474

Signed-off-by: Spencer Schrock <[email protected]>
  • Loading branch information
spencerschrock committed Feb 12, 2025
1 parent 9165624 commit a4a6f9d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ First, [create a new file](https://docs.github.com/en/repositories/working-with-

| Name | Required | Description |
| ----- | -------- | ----------- |
| `result_file` | yes | The file that contains the results. |
| `result_format` | yes | The format in which to store the results [json \| sarif]. For GitHub's scanning dashboard, select `sarif`. |
| `results_file` | yes | The file that contains the results. |
| `results_format` | yes | The format in which to store the results [json \| sarif]. For GitHub's scanning dashboard, select `sarif`. |
| `repo_token` | no | PAT token with repository read access. Follow [these steps](/docs/authentication/fine-grained-auth-token.md) to create it. |
| `publish_results` | recommended | This will allow you to display a badge on your repository to show off your hard work. See details [here](#publishing-results).|
| `file_mode` | no | The method to fetch files from the repository: `archive` or `git` (default `archive`).

### Publishing Results
The Scorecard team runs a weekly scan of public GitHub repositories in order to track
Expand Down
5 changes: 5 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ inputs:
required: false
default: false

file_mode:
description: "INPUT: Method to fetch files from GitHub"
required: false
default: archive

internal_publish_base_url:
description: "INPUT: Base URL for publishing results. Used for testing."
required: false
Expand Down
1 change: 1 addition & 0 deletions options/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const (
EnvInputResultsFile = "INPUT_RESULTS_FILE"
EnvInputResultsFormat = "INPUT_RESULTS_FORMAT"
EnvInputPublishResults = "INPUT_PUBLISH_RESULTS"
EnvInputFileMode = "INPUT_FILE_MODE"
EnvInputInternalPublishBaseURL = "INPUT_INTERNAL_PUBLISH_BASE_URL"
)

Expand Down
4 changes: 4 additions & 0 deletions options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type Options struct {
// Input parameters
InputResultsFile string `env:"INPUT_RESULTS_FILE"`
InputResultsFormat string `env:"INPUT_RESULTS_FORMAT"`
InputFileMode string `env:"INPUT_FILE_MODE"`

PublishResults bool
}
Expand Down Expand Up @@ -199,6 +200,9 @@ func (o *Options) setScorecardOpts() {
if o.ScorecardOpts.ResultsFile == "" {
o.ScorecardOpts.ResultsFile = o.InputResultsFile
}

// --file-mode=
o.ScorecardOpts.FileMode = o.InputFileMode
}

// setPublishResults sets whether results should be published based on a
Expand Down

0 comments on commit a4a6f9d

Please sign in to comment.