Skip to content

ci: wire optional SCORECARD_TOKEN for the Branch-Protection check#115

Merged
timpugh merged 1 commit into
mainfrom
ci/scorecard-branch-protection-pat
Jul 7, 2026
Merged

ci: wire optional SCORECARD_TOKEN for the Branch-Protection check#115
timpugh merged 1 commit into
mainfrom
ci/scorecard-branch-protection-pat

Conversation

@timpugh

@timpugh timpugh commented Jul 7, 2026

Copy link
Copy Markdown
Owner

What

  • scorecard.yml: pass repo_token: ${{ secrets.SCORECARD_TOKEN || github.token }} so the OpenSSF Scorecard Branch-Protection check can read classic branch-protection rules via a fine-grained PAT, falling back to the default token when the secret is absent.
  • README.md: document the opt-in under Code scoring and attestation.

Why

The default GITHUB_TOKEN can't read classic branch-protection settings, so Branch-Protection currently reports an internal error and scores -1. A fine-grained PAT (repo-scoped, Administration: Read-only) stored as SCORECARD_TOKEN lets it read and score them.

Fork / template safe

Repository secrets are never copied to forks or "Use this template" copies, so the || github.token fallback keeps the scan working there — only Branch-Protection degrades to -1, exactly as it does today. No hard failure from the absent secret.

Activation

Merging this is safe before the secret exists (it just falls back). The maintainer then creates the SCORECARD_TOKEN secret and triggers a scan via workflow_dispatch.

Scope

CI workflow + README only — no Python, infra, dependency, or API-surface changes. Validated: check-yaml and make lint-docs pass.

The Branch-Protection Scorecard check needs to read classic branch-protection
rules, which the default GITHUB_TOKEN can't — so it errors and scores -1.
scorecard.yml now passes a repo_token that prefers a fine-grained PAT stored
as the SCORECARD_TOKEN secret and falls back to github.token when it's absent,
so forks and template copies still scan cleanly (only Branch-Protection
degrades there). Documents the opt-in in the README.
@timpugh timpugh enabled auto-merge (squash) July 7, 2026 22:01
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🏗️ CDK infra diff — PR vs main

No CloudFormation template changes.

@timpugh timpugh merged commit 885a1f1 into main Jul 7, 2026
8 checks passed
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.

1 participant