Repository navigation
ci: One Python call stamps the Sphinx docs version (GEN-005, refs #2681) - #2682
Merged
Merged
Conversation
The generate-docs composite action's `setup` step is a 30-line shell block that reads the libobs API version from libobs/obs-config.h and rewrites docs/sphinx/conf.py with sed -- a GEN-005 'shell budget' finding. This pins the shape the port must have: the step is a single `uv run --no-project --script ci/docs_version_stamp.py` line, the module stamps conf.py and writes the step's artifactName/commitHash outputs, the action installs uv itself (all three callers run on a bare ubuntu-26.04), and the GEN-005 exception leaves ci.toml. RED: the module does not exist and the step is still shell.
The generate-docs composite action's `setup` step was a 30-line shell block:
grep/tr/read to split LIBOBS_API_{MAJOR,MINOR,PATCH}_VER out of
libobs/obs-config.h, three `sed -i -E` rewrites of docs/sphinx/conf.py, an
optional link-suffix blank, and two $GITHUB_OUTPUT appends.
It is now a single `uv run --no-project --script ci/docs_version_stamp.py`
line; the module (stdlib only) does the same work byte for byte. The action
installs uv itself with the repo's save-cache/cache-suffix expressions, the
compatibility-validator precedent, because all three callers (ci.yml,
push.yaml, dispatch.yaml update-documentation) run on a bare ubuntu-26.04.
The GEN-005 `[[exceptions]]` block for the action is deleted: precheck goes
491 -> 490 approved exceptions and the generate-docs line is gone, with the
11 violations and 10 needs_review unchanged.
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.
Refs #2681 — the first unit of the GEN-005 (shell budget) burn-down: one composite action's
run:step becomes one call into a Python module.What changed
.github/actions/generate-docs/action.yamlruns.steps[0](id: setup) was a 30-line shell block:grep -E '#define LIBOBS_API_(MAJOR|MINOR|PATCH)_VER '+sed/tr+readto get the libobs API version;sed -i -Erewrites ofdocs/sphinx/conf.py(version,release,copyrightwith the current year);html_link_suffix = None→''blank;$GITHUB_OUTPUTappends (artifactName,commitHash).It is now one line:
ci/docs_version_stamp.py(stdlib only,#!/usr/bin/env -S uv run --script) does the same work: sameLIBOBS_API_*_VERparse, same three substitutions with the same regexes, same two outputs, same "No Extensions" artifact name. A missing define is a hard error naming the file.The action installs uv before the call (
astral-sh/setup-uv, pinned to the SHAcompatibility-validatoralready uses, with the repo'ssave-cache: ${{ github.ref == 'refs/heads/master' }}and the delimitedcache-suffixexpression) because all three callers —ci.yml,push.yaml,dispatch.yaml'supdate-documentationjobs — run on a bareubuntu-26.04with no uv on PATH.ci/test_cache013_actions.pygainsgenerate-docs/action.yamlin itsTARGETSpin for that step.The file's GEN-005
[[exceptions]]block is deleted.RED → GREEN
0ced87273—ci/test_docs_version_stamp.pyonly. Fails on master: the module does not exist (6 errors), thesetupstep is still arun: |shell block, and the ci.toml exception is still present (3 failures).6862b6f3a— the module, the one-line step, the setup-uv step, the CACHE-013 pin, and the exception deletion.RED/GREEN is the precheck header, run against this checkout with the repo's pin:
and the
[GEN-005] APPROVED EXCEPTION .github/actions/generate-docs/action.yaml — runs.steps[0]line is gone, with no new finding in any rule.Local checks:
uv run python -m unittest ci/test_docs_version_stamp.py ci/test_cache013_actions.py ci/test_uv_run.py ci/test_ci_toml.py ci/test_wf002_concurrency.py ci/test_ci_job_timeouts.py ci/test_tool_guard.py— 17 + 13 + … all OK;uvx ruff checkon the touched Python — clean.Notes
test_uv_run.pyinvocation through asubprocessargv pair, which TOOL-003 rightly rejects (uv runmust be the literal text on the line); GREEN drops that redundant check rather than allowlisting the file —ci/test_uv_run.pyruns on its own in CI.github_outputwrite path withmock.patch.dict; that stayed, the argv-based gate test did not.update-documentationis gated ongithub.repository_owner == 'obsproject', so neither PR CI norpush.yamlruns it in this fork; the port is pinned by the unit test instead (fixtureobs-config.h+ fixtureconf.py, both branches ofdisableLinkExtensions).CI/configuration-only change: no
docs/features.mdline.