WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@trask
Copy link
Contributor

@trask trask commented Oct 31, 2025

What kind of change does this PR introduce?

Bug fix – repository rulesets without any include patterns should apply to all branches which aren't explicitly excluded

What is the current behavior?

Scorecard ignores GitHub rulesets that rely on an empty include list (apply to all refs unless excluded), so branches covered only by those rulesets are reported as lacking protection. The branch-protection check emits false warnings such as “Warn: branch protection not enabled for branch 'xyz'”.

What is the new behavior (if this is a feature change)?

Rulesets with no explicit include patterns are now treated as applying to every ref except those explicitly excluded, matching GitHub’s semantics. Branches governed by such rulesets are marked protected and no longer generate false warnings.

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

Which issue(s) this PR fixes

None

Special notes for your reviewer

None

Does this PR introduce a user-facing change?

Fix branch-protection scoring so GitHub rulesets without include patterns are honored, eliminating false warnings for branches covered by those rulesets.

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.49%. Comparing base (353ed60) to head (677aec3).
⚠️ Report is 267 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4835      +/-   ##
==========================================
+ Coverage   66.80%   69.49%   +2.68%     
==========================================
  Files         230      250      +20     
  Lines       16602    15595    -1007     
==========================================
- Hits        11091    10837     -254     
+ 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.

@spencerschrock
Copy link
Member

repository rulesets without any include patterns should apply to all branches which aren't explicitly excluded

Are you sure about that? This is what I see on a test repo when making a ruleset without a target:

This ruleset does not target any resources and will not be applied.

@trask
Copy link
Contributor Author

trask commented Nov 3, 2025

Are you sure about that? This is what I see on a test repo when making a ruleset without a target:

This ruleset does not target any resources and will not be applied.

ah, good point, fixed: 677aec3

@trask trask force-pushed the rulesets-for-all-branches branch from 80630b8 to 677aec3 Compare November 3, 2025 20:57
@trask trask temporarily deployed to integration-test November 3, 2025 20:57 — with GitHub Actions Inactive
@spencerschrock
Copy link
Member

Is this intentionally a draft PR?

@trask
Copy link
Contributor Author

trask commented Nov 3, 2025

yeah, sorry, was going to confirm if we really needed it in OpenTelemetry or not (I think we may need to restructure our rulesets unrelated to this issue). do you prefer that I close until then or would you prefer I just mark it ready for review?

@spencerschrock
Copy link
Member

Up to you, I mainly wanted to make sure this PR wasn't waiting for a review which wasn't assigned.

But this fixes an edge case I didn't know about, so happy to merge it regardless of if OpenTelemetry ends up needing it.

@trask trask marked this pull request as ready for review November 3, 2025 22:42
@trask trask requested a review from a team as a code owner November 3, 2025 22:42
@trask trask requested review from raghavkaul and spencerschrock and removed request for a team November 3, 2025 22:42
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 3, 2025
@spencerschrock
Copy link
Member

/scdiff generate Branch-Protection

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

@spencerschrock spencerschrock merged commit cc6951e into ossf:main Nov 3, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants