Skip to content

Conversation

@gabrielsoltz
Copy link
Contributor

@gabrielsoltz gabrielsoltz commented Sep 16, 2025

What kind of change does this PR introduce?

This PR introduces support for scanning multiple repositories in a single invocation, while preserving existing behavior by default. The only user-visible change for single-repo usage is a small improvement to the “Starting/Finished” banners (they now include the repo label).

New flags

  • --repos: comma-separated list of repositories to scan (e.g., --repos=owner1/repo1,github.com/owner2/repo2).
  • --org: GitHub organization handle (e.g., --org=github.com/ossf or ossf).

Precedence when multiple inputs are provided: --repos ➜ --org ➜ --local ➜ --repo (or repo resolved from package managers).

UX / output changes

Before (single repo):
Starting [License]
Starting [Code-Review]
...
Finished [License]
Finished [Code-Review]
...
Now (single or multi-repo):
Starting (owner/repo) [License]
Starting (owner/repo) [Code-Review]
...
Finished (owner/repo) [License]
Finished (owner/repo) [Code-Review]
...

This makes it obvious which repo each check belongs to—especially important when scanning many repos.

Implementation details

  • Introduce buildRepoURLs(ctx, *options.Options) ([]string, error):
  • Normalizes the input universe and always returns a slice of repo URIs.
  • Honors precedence --repos ➜ --org ➜ --local ➜ single --repo/pkg-manager.
  • Refactor rootCmd to iterate over the returned list and run the same scan pipeline for each repo.
  • ListOrgRepos for listing repositories from the organization, reusing the githubrepo code and logic.

Examples

Scan a list
scorecard --repos=ossf/scorecard,ossf-tests/scorecard-check-branch-protection-e2e
Scan all non-archived repos in an org
scorecard --org=github.com/ossf
  • PR title follows the guidelines defined in our pull request documentation

  • Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

Fixes #4792

Special notes for your reviewer

Does this PR introduce a user-facing change?

For user-facing changes, please add a concise, human-readable release note to
the release-note

(In particular, describe what changes users might need to make in their
application as a result of this pull request.)

Added CLI flags to scan multiple repositories `--repos`, or an entire GitHub organization `--org`

@gabrielsoltz gabrielsoltz changed the title ✨ Implement --org and --repos for scanning organizations or multiple repositories ✨ Add multi-repo scanning: --repos, --org, and optional --combined output Sep 16, 2025
@gabrielsoltz gabrielsoltz marked this pull request as ready for review September 16, 2025 21:20
@gabrielsoltz gabrielsoltz requested a review from a team as a code owner September 16, 2025 21:20
@gabrielsoltz gabrielsoltz requested review from raghavkaul and spencerschrock and removed request for a team September 16, 2025 21:20
@codecov
Copy link

codecov bot commented Sep 17, 2025

Codecov Report

❌ Patch coverage is 33.81295% with 92 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.47%. Comparing base (353ed60) to head (a22d201).
⚠️ Report is 266 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4793      +/-   ##
==========================================
+ Coverage   66.80%   69.47%   +2.67%     
==========================================
  Files         230      250      +20     
  Lines       16602    15589    -1013     
==========================================
- Hits        11091    10831     -260     
+ Misses       4808     3891     -917     
- Partials      703      867     +164     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@spencerschrock spencerschrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a partial review of a few things before I ran out of time, I need to dive more into how you build the repo list, scan repos, and present the results. Feel free to address that feedback now or wait until I have more time for full review

@spencerschrock
Copy link
Member

Also, this repo requires DCO.

> Additionally the Linux Foundation (LF) requires all contributions include per-commit sign-offs.
> Ensure you use the `-s` or `--signoff` flag for every commit.
>
> For more details, see the [LF DCO wiki](https://wiki.linuxfoundation.org/dco)
> or [this Pi-hole signoff guide](https://docs.pi-hole.net/guides/github/how-to-signoff/).

For instructions on how to fix it:
https://github.com/ossf/scorecard/pull/4793/checks?check_run_id=50569515731

@gabrielsoltz gabrielsoltz force-pushed the feat-support-org-and-repos branch from 3ab90d2 to 75c4984 Compare September 19, 2025 08:57
@justaugustus justaugustus mentioned this pull request Sep 20, 2025
2 tasks
@justaugustus justaugustus moved this to In Progress in OpenSSF Scorecard Sep 20, 2025
@justaugustus justaugustus moved this from In Progress to Review in progress in OpenSSF Scorecard Sep 20, 2025
@spencerschrock
Copy link
Member

Just wanted to update you that this is still on my radar! We are trying to cut a 5.3.0 release this week, so my attention has been on that. But once that's cut this week, I will make time to finish. my review, and happy to cut a 5.4.0 or 5.3.1 shortly after

Copy link
Member

@spencerschrock spencerschrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach overall, I think building a slice of repos and looping over them is the correct approach. Most of my issue is with the --combined output format, is there anyway we can split that into its own PR? I think that would help get --repos and --org merged first.

@github-actions
Copy link

This pull request has been marked stale because it has been open for 10 days with no activity

@github-actions github-actions bot added the Stale label Oct 14, 2025
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Oct 16, 2025
@gabrielsoltz
Copy link
Contributor Author

Hey @spencerschrock, thank you so much for reviewing my PR — and sorry it took me a while to address your comments; I couldn’t get to it earlier. I left two small cosmetic notes (one about the banners and one about the URI) for us to discuss. Whenever you have a moment, this is ready for another review. ✌️

Signed-off-by: Gabriel Alejandro Soltz <[email protected]>
Signed-off-by: Gabriel Alejandro Soltz <[email protected]>
Signed-off-by: Gabriel Alejandro Soltz <[email protected]>
Signed-off-by: Gabriel Alejandro Soltz <[email protected]>
Signed-off-by: Gabriel Alejandro Soltz <[email protected]>
Signed-off-by: Gabriel Alejandro Soltz <[email protected]>
Signed-off-by: Gabriel Alejandro Soltz <[email protected]>
Signed-off-by: Gabriel Alejandro Soltz <[email protected]>
Signed-off-by: Gabriel Alejandro Soltz <[email protected]>
@gabrielsoltz gabrielsoltz force-pushed the feat-support-org-and-repos branch from 91600a2 to 07e8adc Compare October 16, 2025 20:06
Signed-off-by: Gabriel Alejandro Soltz <[email protected]>
Signed-off-by: Gabriel Alejandro Soltz <[email protected]>
@spencerschrock
Copy link
Member

Whenever you have a moment, this is ready for another review

I will get to this tomorrow, thanks for your patience.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Oct 31, 2025
@spencerschrock spencerschrock changed the title ✨ Add multi-repo scanning: --repos, --org, and optional --combined output ✨ Add multi-repo scanning: --repos, --org Oct 31, 2025
Copy link
Member

@spencerschrock spencerschrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the interest of getting this merged, I cut out the --format=combined logic, which can be added in a follow-up when the author has time by reverting my removal commit and addressing followups.

My approval is good for all of the code written by the author, but I'll request @AdamKorcz to review my removal of the combined format code:
a22d201

@justaugustus justaugustus enabled auto-merge (squash) October 31, 2025 19:45
Copy link
Member

@justaugustus justaugustus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for a22d201.
ref: #4793 (review)

@justaugustus justaugustus merged commit 976314d into ossf:main Oct 31, 2025
40 of 41 checks passed
@github-project-automation github-project-automation bot moved this from Review in progress to Done in OpenSSF Scorecard Oct 31, 2025
@spencerschrock
Copy link
Member

Thanks Stephen, and of course thanks Gabriel for the multi repo logic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Feature: Support Scanning Github Organizations and Multiple Repositories

9 participants