mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
The workflow directory mixed entry points, reusable stages and scheduled jobs into one flat list sorted by topic, so the first question about any file - what starts it - was the one the name did not answer. Every workflow now carries one of three prefixes, derived from its on: block: cron- for a schedule trigger, call- for one only reachable through workflow_call, entry- for everything a repository event or a human starts. Scheduled workflows additionally carry an alarm clock as the first character of their name. Two lints keep it that way. One derives the expected prefix from the triggers and compares it against the file name; it flagged all 17 offenders before the rename and none after. The other resolves every .github/workflows/<file> string in the repository against the directory, which is what a rename silently breaks in Markdown links, Python constants and shell API URLs alike. Renaming pulled 69 pre-existing comments into the comment lint's changed-file scope. The vendored CodeQL template got the nocheck marker its scorecard sibling already carried, two workflow headers moved above name: where they count as file headers, and the remaining banners were deleted. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
"""Render a manual CI run name from its workflow source of truth.
|
|
|
|
Single point of truth for test fixtures, for the same reason
|
|
``utils.github.run_name`` parses rather than hard-codes the format: a
|
|
hand-typed title drifts the moment ``entry-manual-steer.yml`` changes its
|
|
``run-name``, and the retrigger that reads configuration back out of it
|
|
would silently start recovering nothing.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from utils.github import run_name
|
|
|
|
_GLYPH_OF = {value: glyph for glyph, value in run_name.VALUE_GLYPHS.items()}
|
|
|
|
|
|
def render(config: dict[str, str]) -> str:
|
|
"""The run name ``entry-manual-steer.yml`` builds for *config*.
|
|
|
|
Args:
|
|
config: dispatch inputs that deviate from their workflow default,
|
|
keyed by input name. An input on its default renders no segment,
|
|
so passing it here would produce a title the workflow never emits.
|
|
|
|
Returns:
|
|
The rendered title, segments in the order the run name declares them.
|
|
"""
|
|
literals, _expressions = run_name._split(run_name.template())
|
|
parts = [literals[0]]
|
|
for name, literal, marker in run_name.segments():
|
|
value = config.get(name)
|
|
if marker:
|
|
parts.append(f"{literal} " if value == "true" else "")
|
|
elif value:
|
|
parts.append(f"{literal}{_GLYPH_OF.get(value, value)} ")
|
|
return "".join(parts).rstrip()
|