Skip to content

Commit 10cc16e

Browse files
committed
Enhance access management documentation with pre-commit and CI validation strategies
1 parent 61754e2 commit 10cc16e

1 file changed

Lines changed: 72 additions & 2 deletions

File tree

docs/explanation/access-management.rst

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,36 @@ Configure branch protection to enforce quality gates:
454454
Pre-commit Hooks
455455
~~~~~~~~~~~~~~~~
456456

457-
Use pre-commit hooks for local validation before push:
457+
Use pre-commit hooks for local validation before push.
458+
459+
**Using ubCode (ubc)**
460+
461+
The recommended approach is to use `ubCode <https://ubcode.useblocks.com>`_ (``ubc``),
462+
the Sphinx-Needs companion CLI that provides built-in validation:
463+
464+
.. code-block:: yaml
465+
466+
# file: .pre-commit-config.yaml
467+
repos:
468+
- repo: local
469+
hooks:
470+
- id: ubc-check
471+
name: Validate Sphinx-Needs with ubCode
472+
entry: ubc check docs/
473+
language: system
474+
files: '\.rst$'
475+
pass_filenames: false
476+
477+
``ubc check`` validates:
478+
479+
* Need ID uniqueness and format
480+
* Required fields and attributes
481+
* Link integrity between needs
482+
* Schema compliance (when configured)
483+
484+
**Custom Validation Scripts**
485+
486+
Alternatively, use custom Python scripts for specific validation rules:
458487

459488
.. code-block:: yaml
460489
@@ -477,7 +506,48 @@ Use pre-commit hooks for local validation before push:
477506
CI Validation
478507
~~~~~~~~~~~~~
479508

480-
Use CI to enforce constraints that complement access control:
509+
Use CI to enforce constraints that complement access control.
510+
511+
**Using ubc-action**
512+
513+
The `ubc-action <https://github.com/useblocks/ubc-action>`_ provides a GitHub Action
514+
to run ubCode validation in your CI pipeline:
515+
516+
.. code-block:: yaml
517+
518+
# file: .github/workflows/validate-requirements.yml
519+
name: Validate Requirements
520+
on: [pull_request]
521+
522+
jobs:
523+
validate:
524+
runs-on: ubuntu-latest
525+
steps:
526+
- uses: actions/checkout@v4
527+
528+
- name: Setup ubCode
529+
uses: useblocks/ubc-action@v1
530+
with:
531+
license-key: ${{ secrets.UBCODE_LICENSE_KEY }}
532+
license-user: ${{ secrets.UBCODE_LICENSE_USER }}
533+
534+
- name: Validate requirements with ubCode
535+
run: ubc check docs/
536+
537+
- name: Build documentation (strict mode)
538+
run: |
539+
pip install sphinx sphinx-needs
540+
sphinx-build -W -b html docs docs/_build/html
541+
542+
.. tip::
543+
544+
For a complete example of a documentation build workflow with GitHub Actions,
545+
see this repository's workflow in ``.github/workflows/gh_pages.yml`` or view it on
546+
`GitHub <https://github.com/useblocks/x-as-code/blob/main/.github/workflows/gh_pages.yml>`_.
547+
548+
**Custom Validation Scripts**
549+
550+
For additional validation beyond what ubCode provides:
481551

482552
.. code-block:: yaml
483553

0 commit comments

Comments
 (0)