The template caller convention¶
templates/ hands configuration to the rest of the fleet. There are
two ways to do that, and which one a template uses is a decision with
consequences, so this page states the convention: a template meant
to be identical in every repository is a caller stub, and anything
else says in its README how drift in its copies is caught.
Why¶
Copying does not hold. Read across the fleet in late 2026,
codeql-analysis.yml existed in 23 repositories as 16 distinct files,
and pr-re-review.yml in 24 as seven. The copies were not adapted;
they were generations. A repository took the template once, the
template moved on, and nothing brought the copy forward.
The audit did not notice, because most criteria ask whether a file is
present and whether it behaves, not whether it matches. GithubSecurity
asks only that .github/workflows/codeql-analysis.yml exists, which is
how sixteen versions sat under a passing criterion for months.
A caller stub removes the question. The work lives once, in
shakenfist/actions, and the adopter's file holds only what is
genuinely its own: triggers, permissions, and inputs. There is no
generational drift in a file with nothing in it to drift, and the
stub is the one shape a byte comparison measures completely.
What a caller stub is¶
A stub delegates all of its work to shakenfist/actions and keeps
none. Concretely: no run: steps of its own, and no delegation to a
workflow inside the adopter's own repository. Two shapes are
legitimate, and they are not interchangeable.
- A reusable workflow, called at job level. The job is a bare
uses:withwith:andsecrets:. This is the shape for work that needs its own job, its ownruns-on:, or a job-levelenvironment:, because a composite action cannot set any of those.templates/export-repo-config/andtemplates/issue-link-check/are both this shape. - A composite action, called at step level. The job keeps its
runs-on:and may carry anactions/checkoutbeside the call. This is the shape for work that needs a file the callee ships, because a composite action can read its own repository throughgithub.action_pathwhile a reusable workflow would need a second checkout to do it.templates/mermaid-lint/is this shape: the checker script travels with the action.
The composite shape has a cost worth stating plainly. A composite
action runs inside the caller's job, with that job's environment and
its secrets, which is wider exposure than a reusable workflow's own
job. That is acceptable here because shakenfist/actions main
requires a pull request and passing CI, which is what makes a moving
@main reference safe to depend on at all; see
audits/moving-ref-source-protection.md.
First-party references are taken at @main deliberately, rather than
pinned to a sha. Pinning them would mean a pull request in every
repository for every change to a shared workflow. Third-party actions
are the opposite case and are pinned to a sha under Renovate.
When a template stays a template¶
Converting is not always right, and three reasons recur.
- The job graph differs between adopters. A reusable workflow's
job graph is static, and no
with:input adds a job. The release workflows are the example: some adopters publish a collection as well as a wheel, one publishes to a marketplace and has no signing job at all. Those are different graphs, not one graph with inputs. - There is no workflow to reduce.
templates/source-size-ratchet/ships a job fragment to paste into an existing gate and a pre-commit stanza to merge into the adopter's configuration. A reusable workflow cannot be wired into a repository's gate from outside it, and a composite action cannot be what a local pre-commit hook runs. - The population is two. A conversion costs a callee, a stub, a criterion change and a pull request per adopter. Where there are only one or two copies the drift it prevents is smaller than the machinery.
A template that stays a template owes its README an explicit answer to
one question: how is drift in its copies caught? A criterion that
byte-compares the copy against the template is the strongest answer. A
criterion that compares everything outside a delimited
per-repository customisation region is the next best, and is the shape
release-process uses for its Rust half. "It is reviewed when someone
notices" is not an answer, and a template whose README says nothing is
the state this convention exists to end.
How the convention is held¶
Two mechanisms, and they do different jobs.
CONVERTED_TEMPLATES in scripts/tests/test_templates.py lists every
template that has been converted, each with the one
shakenfist/actions reference it exists to call.
ConvertedTemplatesTest fails if a listed template stops being a
stub, if it re-points at a different callee, if a list entry names a
file that is not there, and — this is the one that matters most — if a
template became a stub without being added to the list. A conversion
that does not extend the list is unmeasured, so each conversion
appends to it in the same pull request that converts it.
That test holds the templates in this repository. What holds the
fleet's copies is a criterion per converted workflow, which fails a
repository still running its own copy; mermaid-lint-ci is the worked
example. The weekly consistency audit then files an issue against each
failing repository, and those issues are the rollout's work queue
rather than a sweep driven from here. See
consistency-audits.md for how criteria are
added and how the audit files and closes issues.
The division is deliberate. The test catches a convention breaking where it is defined, in one repository, at commit time. The criterion catches it where it is deployed, across the fleet, on a schedule. Neither substitutes for the other.
Related¶
consistency-audits.md-- the audit that measures the fleet's copies, and how to add a criterion.audits/moving-ref-source-protection.md-- why a first-party@mainreference is safe to depend on.audits/README.md-- the criterion index.templates/shared-blocks/README.md-- the other way canonical wording is shared, by embedding a versioned block rather than by calling out to it.