ci(pages): upload bca self-scan offenders to Code Scanning#499
Merged
Conversation
The scan job already runs bca against its own source and publishes Markdown/HTML reports plus the threshold gate, but it never emitted bca's own SARIF — the one GitHub-native output we document for adopters in commands/check.md and recipes/ci.md. CI even uploads clippy's SARIF, so we dogfooded a third-party tool's SARIF but not our own writer. Emit `bca check --output-format sarif --no-fail` and upload it via the same pinned codeql-action/upload-sarif used for clippy, under a distinct `category: bca`. The step uses `--no-fail` + `if: always()` so the SARIF publishes even when the gate is red, and reads the same auto-discovered bca.toml manifest as the gate so the alerts match the gate's baseline-filtered offender set. Adds security-events:write + actions:read to the scan job (default is contents:read), mirroring ci.yml's clippy job.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
d3566d0 to
c870e81
Compare
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.
What
Wire
bca's own SARIF output into thescanjob inpages.ymlandupload it to GitHub Code Scanning, closing a dogfooding gap: the repo
already ships a SARIF writer and documents
bca check --output-format sarif --no-fail+upload-sarifas the GitHub-native integrationpath for adopters — and
ci.ymlalready uploads clippy's SARIF —yet
bca's own self-scan offenders never reached Code Scanning.Changes
.github/workflows/pages.ymlpermissionsblock toscan(
security-events: write+actions: read; workflow defaultstays
contents: read), mirroringci.yml's clippy job.bca check --output-format sarif --no-fail --output bca.sarif.--no-fail+if: always()means it emits even when the gate isred. It reads the same auto-discovered
bca.tomlmanifest as thegate, so published alerts match the gate's baseline-filtered
offender set.
same pinned
github/codeql-action/upload-sarifas clippy, under adistinct
category: bca, with the same fork-PR guard.big-code-analysis-book/src/recipes/ci.md— update the"Live worked example" to note the workflow now also exercises a
SARIF upload end-to-end, including the fork-PR exception.
Semantics
The SARIF is baseline-filtered (same config as the gate), so Code
Scanning shows only regressions past
.bca-baseline.toml— i.e. whatwould actually fail CI — rather than permanently surfacing accepted
debt. The Markdown/HTML reports keep the full offender picture.
Validation
make actionlint— clean.make markdown-lint— clean.bca check --output-format sarif --no-fail --output bca.sariflocally: well-formed SARIF 2.1.0; 0 results today because the repo
sits at a clean baseline (expected — it lights up on the first
beyond-baseline regression).
Notes
The
scanjob now runsbca checktwice (gate + SARIF emit). This isa deliberate tradeoff: collapsing to one parse would mean making the
SARIF invocation the gate, which breaks the local/CI gate-invocation
unification and replaces human-readable gate logs with raw SARIF JSON.
The extra analysis pass is seconds in a job dominated by the release
build, so two parses is the right call.