Skip to content

feat: Add results file input for Scorecard data#90

Open
justaugustus wants to merge 4 commits intomainfrom
local-results
Open

feat: Add results file input for Scorecard data#90
justaugustus wants to merge 4 commits intomainfrom
local-results

Conversation

@justaugustus
Copy link
Copy Markdown
Member

@justaugustus justaugustus commented Jan 25, 2025

Summary

Add a results-path Action input that enables reading Scorecard results from a JSON file instead of the public Scorecard API. This enables integration with tools that produce Scorecard results directly, such as Allstar and Scorecard's own --org multi-repo scanning (ossf/scorecard#4793).

Supersedes the experimental hack from commit 51b8e77 with a proper, configurable implementation that supports both API and file-based results modes.

Changes

  • action.yml: Add results-path input; make scope not required (repos discovered from results)
  • src/index.js: Refactor generateScores() to support both API and file-based results via conditional logic. Both paths converge to the same database enrichment (history, deltas, report generation). Remove hardcoded require('../results.json').
  • src/action.js: Restore input reading (was hardcoded by the hack); pass resultsPath to generateScores(); skip scope validation when results file is provided.
  • dist/index.js: Rebuilt via ncc
  • README.md: Document results-path input and add usage example

Results file format

The input file should contain an array of Scorecard JSON v2 results:

[
  {
    "date": "2026-03-28T15:30:00Z",
    "repo": {
      "name": "github.com/org/repo",
      "commit": "abc123..."
    },
    "score": 6.6,
    "checks": [...]
  }
]

Usage

- uses: ossf/scorecard-monitor@local-results
  with:
    database: database.json
    report: report.md
    results-path: results.json
    auto-commit: true
    auto-push: true

Related PRs

Test plan

  • All 26 existing tests pass
  • Manual test: results file parsed correctly (2 repos)
  • End-to-end: Allstar produces Scorecard JSON v2 (11 repos) -> scorecard-monitor consumes it -> valid Markdown report with all repos
  • API mode: backward compatible (default behavior unchanged when results-path not set)

🤖 Generated with Claude Code

jeffmendoza and others added 2 commits March 28, 2026 02:29
Signed-off-by: Jeff Mendoza <jlm@jlm.name>
Add a `local-results-path` Action input that enables reading Scorecard
results from a local JSON file instead of the public Scorecard API.
This enables integration with tools like Allstar that produce Scorecard
results locally.

When `local-results-path` is set:
- Scores are read from the specified file (Scorecard JSON v2 format)
- The `scope` input is not required (repos are discovered from results)
- Database enrichment (history, deltas) works identically to API mode

When `local-results-path` is not set:
- Existing API-based behavior is preserved (no changes)

This replaces the experimental hardcoded local results hack (51b8e77)
with a proper, configurable implementation that supports both modes.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
@justaugustus justaugustus changed the title Hack to support local results feat: add local results mode for Scorecard data Mar 28, 2026
Drop "local" from naming throughout:
- Action input: local-results-path -> results-path
- Variables: localResultsPath -> resultsPath
- Functions: parseLocalResults -> parseResults

The results file can come from any source — Allstar, Scorecard CLI
with --org, or a CI pipeline. "Local" implied a contrast with "remote"
that isn't meaningful for the input.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
@justaugustus justaugustus changed the title feat: add local results mode for Scorecard data feat: add results file input for Scorecard data Mar 28, 2026
Add documentation for the new results-path input:
- Option description in the Options section
- Usage example showing how to use a Scorecard results file
  (from scorecard --org, Allstar, or other sources)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
@justaugustus justaugustus changed the title feat: add results file input for Scorecard data feat: Add results file input for Scorecard data Mar 28, 2026
justaugustus added a commit to uwu-tools/.github that referenced this pull request Mar 28, 2026
Update the Allstar workflow to:
- Use the results-json-output branch (includes SARIF upload +
  results file output)
- Pass -results-file to produce Scorecard JSON v2 output
- Add a monitor job that feeds the results into scorecard-monitor
  for dashboard reporting

The monitor job uses scorecard-monitor's results-path input
(ossf/scorecard-monitor#90) to consume Allstar's output and
generate a Markdown report with score history.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
justaugustus added a commit to uwu-tools/.github that referenced this pull request Mar 28, 2026
Update the Allstar workflow to:
- Use the results-json-output branch (includes SARIF upload +
  results file output)
- Pass -results-file to produce Scorecard JSON v2 output
- Add a monitor job that feeds the results into scorecard-monitor
  for dashboard reporting
- Use peter-evans/create-pull-request for human review of report
  updates (matching bloomberg/.github pattern)

The monitor job uses scorecard-monitor's results-path input
(ossf/scorecard-monitor#90) to consume Allstar's output and
generate a Markdown report with score history.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Stephen Augustus <foo@auggie.dev>
justaugustus added a commit to uwu-tools/.github that referenced this pull request Mar 28, 2026
* ci: add scorecard-monitor integration with results file

Update the Allstar workflow to:
- Use the results-json-output branch (includes SARIF upload +
  results file output)
- Pass -results-file to produce Scorecard JSON v2 output
- Add a monitor job that feeds the results into scorecard-monitor
  for dashboard reporting
- Use peter-evans/create-pull-request for human review of report
  updates (matching bloomberg/.github pattern)

The monitor job uses scorecard-monitor's results-path input
(ossf/scorecard-monitor#90) to consume Allstar's output and
generate a Markdown report with score history.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Stephen Augustus <foo@auggie.dev>

* Apply suggestions from code review

Co-authored-by: Stephen Augustus <justaugustus@users.noreply.github.com>
Signed-off-by: Stephen Augustus <justaugustus@users.noreply.github.com>

---------

Signed-off-by: Stephen Augustus <foo@auggie.dev>
Signed-off-by: Stephen Augustus <justaugustus@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants