Skip to content

Remove stale generated documentation when policy packages are deleted #1768

Description

@st3penta

When a Rego policy package is removed from policy/, its generated .adoc file in antora/docs/modules/ROOT/pages/packages/ persists in the repo and published docs. CI doesn't catch this: generate-docs followed by git diff --exit-code only detects additions and modifications, not leftover files from deleted packages.

Same problem as conforma/cli#1512, fixed there in conforma/cli#3383.

The fix here should be simpler than the cli version. All generated per-package files live in the packages/ subdirectory, separate from handwritten pages (index.adoc, authoring.adoc, etc.). So instead of the marker-based approach used in cli, GenerateAsciidoc() could just remove all .adoc files from packages/ before regenerating, since everything in that directory is generated.

Nav partials and top-level policy pages (one per category, fully overwritten each run) are not affected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions