Skip to content

docs: update Learn page statistics and add CI/CD for auto-updates #228

Description

@parthrohit22

What problem does this solve?

docs/learn/index.html hardcodes repository statistics that were correct when the page was
written and have drifted since. The page currently advertises:

Statistic Page says Actual
Azure scan rules 39 65
CLI remediation playbooks 39 65
High-severity checks 22 38

Two problems follow from this:

  1. The Learn page understates the project. New contributors and evaluators land on it and
    see roughly half the coverage OpenShield actually ships.
  2. It will drift again. Every scanner-rule PR that merges to dev makes the numbers more
    wrong, and nothing in CI notices. Manual correction is not sustainable at the rate rules
    are being added.

Describe the solution

Two parts:

1. Correct the current numbers in docs/learn/index.html — the headline counts, the
pipeline step, the section title, and the intro paragraph all repeat the same figures and
must be updated together.

2. Add a GitHub Actions workflow that keeps them correct. On every push to dev:

  • Derive the counts from the codebase rather than from a checked-in constant:
    • rule count from scanner/rules/ (files that declare a RULE_ID)
    • playbook count from playbooks/cli/*.sh
    • severity counts from each rule's SEVERITY value
  • Rewrite the statistics in docs/learn/index.html
  • Commit and push only when something actually changed, tagged [skip ci] so the workflow
    cannot retrigger itself

The update script must be idempotent: running it on an already-current page produces no diff.

Alternatives considered

  • Keep updating the page by hand. Rejected — this issue exists precisely because that
    failed. The numbers went stale within a few release cycles.
  • A CI check that fails the build when the numbers are stale, rather than auto-committing.
    Lower blast radius and no bot commits on dev, but it pushes the chore onto every
    contributor whose PR happens to change a count. Worth revisiting if the auto-commit
    approach turns out to conflict with branch protection on dev.
  • Render the statistics client-side from a generated JSON file. Cleaner separation, but
    the Learn page is deliberately a single static HTML file with no build step, and adding one
    is out of proportion to the problem.

Additional context

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Type

No type

Projects

Status
🔨 In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions