use Scorecard library entrypoint instead of Cobra hooking#1423
Merged
justaugustus merged 4 commits intoossf:mainfrom Aug 10, 2024
Merged
use Scorecard library entrypoint instead of Cobra hooking#1423justaugustus merged 4 commits intoossf:mainfrom
justaugustus merged 4 commits intoossf:mainfrom
Conversation
Scorecard V5 released a new entrypoint, so make use of it instead of hooking into the underlying Cobra CLI. This gives us more flexibility when running Scorecard, such as writing the result to multiple formats. Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Member
Author
Testing the Dockerfile locally, the JSON output is identical (using But there aren't any great e2e tests currently setup before merge. |
justaugustus
requested changes
Aug 10, 2024
Member
justaugustus
left a comment
There was a problem hiding this comment.
Minor nits.
Looks much cleaner, @spencerschrock!!
Signed-off-by: Stephen Augustus <justaugustus@users.noreply.github.com>
justaugustus
approved these changes
Aug 10, 2024
Member
justaugustus
left a comment
There was a problem hiding this comment.
Approving with code suggestions applied from #1423 (review).
Closed
This was referenced May 4, 2025
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scorecard V5 released a new entrypoint, so make use of it instead of
hooking into the underlying Cobra CLI. This gives us more flexibility
when running Scorecard, such as writing the result to multiple formats.
The code got moved around a lot, my hope is it's organized more
clearly now, but I'll try to summarize it for the sake of the reviewer.
entrypoint/entrypoint.goused to do several thingsRead the Scorecard Action options, which now takes place in our
main.goscorecard-action/main.go
Lines 35 to 39 in 486e8de
All sorts of pre/post hooks to redirect output to both stdout and a result file. Which is done explicitly in a new format helper function.
scorecard-action/internal/scorecard/format.go
Lines 47 to 53 in 486e8de
signing/signing.gore-ran scorecard viaGetJSONScorecardResults, which is now a simple extra formatting call.scorecard-action/main.go
Lines 54 to 58 in 486e8de
In terms of testing, separating the format code makes it more testable! But the rest of it is very hard to unit test. I'll look into testing the rest of it.
Fixes #1071