Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/actions/resolve-upstream/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
name: Hub resolve-upstream hook
description: Resolve the newest released upstream line of each host tool the hub pins to one line.

# Declared so check-upstream-version-task.yml's guarded hook-input step passes actionlint here, and as the declaration a caller's own hook copies.
# The hub calls the task once, so this hook ignores the value.
inputs:
hook-input:
description: The caller's hook-input value, which the task passes only when it is non-empty.
required: false
default: ''

outputs:
versions:
description: Compact JSON object of pinned tool name -> newest released line, such as python 3.14 and dotnet 10.
Expand Down
8 changes: 8 additions & 0 deletions .github/actions/validate/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
name: Validate repository (hub)
description: Registry and spec validation, the audit helper suite and the self-tests outside the unittest suite, a strict type check of the carried hub_fetch_run.py, the fleet-skills freshness check, and the unclassified-character report.

# Declared so validate-task.yml's guarded hook-input step passes actionlint here, and as the declaration a caller's own hook copies.
# The hub's own caller passes no hook-input, so this hook ignores the value.
inputs:
hook-input:
description: The caller's hook-input value, which the task passes only when it is non-empty.
required: false
default: ''

runs:
using: composite
steps:
Expand Down
21 changes: 19 additions & 2 deletions .github/workflows/check-upstream-version-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ on:
required: false
type: boolean
default: true
hook-input:
description: >-
Free-form string handed to the resolve-upstream hook as its hook-input input, only when non-empty.
A repository calling this task more than once passes each call its own value, so one hook can tell which caller runs it.
A hook receiving a non-empty value declares hook-input as an input.
required: false
type: string
default: ''
secrets:
CODEGEN_APP_CLIENT_ID:
required: true
Expand Down Expand Up @@ -75,11 +83,20 @@ jobs:
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false

# The caller's hook-input reaches the hook only from a step of its own, run when the caller set it.
# So a caller passing none runs a hook declaring no such input, such as one written before hook-input existed, exactly as before.
- name: Run resolve-upstream hook step
id: resolve-upstream
if: ${{ hashFiles('.github/actions/resolve-upstream/action.yml') != '' }}
if: ${{ hashFiles('.github/actions/resolve-upstream/action.yml') != '' && inputs.hook-input == '' }}
uses: ./.github/actions/resolve-upstream

- name: Run resolve-upstream hook with hook input step
id: resolve-upstream-with-input
if: ${{ hashFiles('.github/actions/resolve-upstream/action.yml') != '' && inputs.hook-input != '' }}
uses: ./.github/actions/resolve-upstream
with:
hook-input: ${{ inputs.hook-input }}

- name: Missing resolve-upstream hook step
if: ${{ hashFiles('.github/actions/resolve-upstream/action.yml') == '' }}
run: |
Expand All @@ -93,7 +110,7 @@ jobs:
- name: Compute upstream version diff step
id: resolve
env:
NEW_VERSIONS: ${{ steps.resolve-upstream.outputs.versions }}
NEW_VERSIONS: ${{ steps.resolve-upstream.outputs.versions || steps.resolve-upstream-with-input.outputs.versions }}
STATE_FILE: ${{ inputs.state-file }}
BUMP_BRANCH_PREFIX: ${{ inputs.bump-branch-prefix }}
AUTO_MERGE: ${{ inputs.auto-merge }}
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/validate-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ on:
required: false
type: string
default: release
# Handed to the caller's validate hook by the validate job's guarded hook step, never to the hub default.
hook-input:
description: Free-form string handed to the caller's validate hook as its hook-input input, only when non-empty, for example a change-gate result so an expensive domain check can skip a change that does not touch it. A hook receiving a non-empty value declares hook-input as an input. A caller carrying no validate hook runs the hub's no-op default, which never receives it.
required: false
type: string
default: ''
secrets:
CODECOV_TOKEN:
required: false
Expand Down Expand Up @@ -1096,10 +1102,18 @@ jobs:

# A local composite action resolves at step time from the workspace, which is what makes this fallback expressible at all.
# It runs the caller's own hook when it carries one, else the hub's no-op default.
# The caller's hook-input reaches the hook only from a step of its own, run when the caller set it.
# So a caller passing none runs a hook declaring no such input exactly as before.
- name: Run repository validate hook step
if: hashFiles('.github/actions/validate/action.yml') != ''
if: hashFiles('.github/actions/validate/action.yml') != '' && inputs.hook-input == ''
uses: ./.github/actions/validate

- name: Run repository validate hook with hook input step
if: hashFiles('.github/actions/validate/action.yml') != '' && inputs.hook-input != ''
uses: ./.github/actions/validate
with:
hook-input: ${{ inputs.hook-input }}

- name: Run default validate hook step
if: hashFiles('.github/actions/validate/action.yml') == ''
uses: $/.github/actions/validate-default
8 changes: 5 additions & 3 deletions docs/reusable-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ A workflow whose job graph is identical across repos of a type is reached, not c

### The Hook Contract

A hook receives the fixed inputs [WORKFLOW.md "Reusable-Task Parameter Contract"][workflow-reusable-task-parameter-contract] gives a leaf today. Those are `ref`, `branch`, `smoke` where relevant, and the NBGV version outputs where a build needs them. It reports back through step outputs and, for a release target, through the existing artifact seam, `release-asset-<branch>-<target>`, which the hub's `github-release` job collects by pattern. Each task finds a hook by its `action.yml` alone, so a hook named `action.yaml` is never run. The `install-test-deps` hook is an exception, taking `leg` and `directories` inputs and reporting nothing back. It may also run a check that needs that leg's environment. A failure there fails the leg's `unit-test` job before its Python tests run. The `pre-test` hook is another, taking no inputs and reporting nothing back. Each `unit-test` leg runs it before the .NET SDK setup, where a .NET test project exists and the caller carries the hook. So a system tool a .NET test shells out to is installed before those tests run. The `build-release-asset` hook is another, writing its files into the `output-directory` it receives, on a smoke run too, and leaving the upload to the task. The task accepts only regular files at that directory's top level and refuses a subdirectory, a symlink, or a dot-prefixed name. A package hook also uploads the artifact its publish job consumes: a NuGet hook uploads `nuget-build-<branch>` as well as its `release-asset-*`. A PyPI hook uploads `pypi-build-<branch>` and no release asset at all. A NuGet or PyPI hook has to carry that exact package-artifact name or its publish job finds nothing. A hook may use marketplace actions, which is the reason a hook is a composite action rather than a script. A toolchain setup, a Docker build, or a coverage upload is a `uses:` step, and a shell script cannot carry one. Action pins inside a hook follow the SHA-pinning rule like any other workflow content, and Dependabot bumps them in the repo that carries the hook. A hook runs with no persisted git credential, since every checkout ahead of a hook sets `persist-credentials: false`. A hook that runs git against the remote therefore passes its own credential to that call.
A hook receives the fixed inputs [WORKFLOW.md "Reusable-Task Parameter Contract"][workflow-reusable-task-parameter-contract] gives a leaf today. Those are `ref`, `branch`, `smoke` where relevant, and the NBGV version outputs where a build needs them. It reports back through step outputs and, for a release target, through the existing artifact seam, `release-asset-<branch>-<target>`, which the hub's `github-release` job collects by pattern. Each task finds a hook by its `action.yml` alone, so a hook named `action.yaml` is never run. The `install-test-deps` hook is an exception, taking `leg` and `directories` inputs and reporting nothing back. It may also run a check that needs that leg's environment. A failure there fails the leg's `unit-test` job before its Python tests run. The `pre-test` hook is another, taking no inputs and reporting nothing back. Each `unit-test` leg runs it before the .NET SDK setup, where a .NET test project exists and the caller carries the hook. So a system tool a .NET test shells out to is installed before those tests run. The `build-release-asset` hook is another, writing its files into the `output-directory` it receives, on a smoke run too, and leaving the upload to the task. The task accepts only regular files at that directory's top level and refuses a subdirectory, a symlink, or a dot-prefixed name. A package hook also uploads the artifact its publish job consumes: a NuGet hook uploads `nuget-build-<branch>` as well as its `release-asset-*`. A PyPI hook uploads `pypi-build-<branch>` and no release asset at all. A NuGet or PyPI hook has to carry that exact package-artifact name or its publish job finds nothing. The `validate` and `resolve-upstream` hooks can also take one string from their caller. `validate-task.yml` and `check-upstream-version-task.yml` each declare an optional `hook-input` input. Each passes a non-empty value on to its hook's own `hook-input` input. The task passes it from a step of its own, run only when the caller sets it. So a caller passing none runs a hook declaring no such input exactly as before. A caller that sets it needs a hook declaring `hook-input` as an optional input. The caller defines what the value means. It can name which of two callers runs the hook, or carry a change-gate result an expensive check skips on. The hub's no-op `validate-default` never receives it. A hook may use marketplace actions, which is the reason a hook is a composite action rather than a script. A toolchain setup, a Docker build, or a coverage upload is a `uses:` step, and a shell script cannot carry one. Action pins inside a hook follow the SHA-pinning rule like any other workflow content, and Dependabot bumps them in the repo that carries the hook. A hook runs with no persisted git credential, since every checkout ahead of a hook sets `persist-credentials: false`. A hook that runs git against the remote therefore passes its own credential to that call.

### Pinning

Expand Down Expand Up @@ -239,7 +239,7 @@ Hub: `publish-docker-readme-task.yml` with a `docker-readme-transform` hook, `ch
- [x] VSCode-Server-DotNetCore (`publish-docker-readme-task.yml`): `publish-release.yml` on `main`, its ground-truth branch, calls `publish-docker-readme-task.yml` by pin and keeps no local copy, at `e571822`. There the `main` audit run 2026-10-16T06:40:34Z reports no `interface` finding.
- [x] PlexCleaner (`publish-docker-readme-task.yml`): adopted on `develop` in ptr727/PlexCleaner#940 at `0e9b0b9`, merged 2026-08-30 and carried on `main`, its ground-truth branch. There `publish-release.yml` calls `publish-docker-readme-task.yml` by pin and keeps no local copy.
- [ ] NxWitness (`publish-docker-readme-task.yml`, moving the readme job out of `publish-release.yml`, and `run-codegen-pull-request-task.yml` with its scheduler)
- [ ] ESPHome-NonRoot (`check-upstream-version-task.yml`, both trackers, the second with `auto-merge: false`)
- [ ] ESPHome-NonRoot (`check-upstream-version-task.yml`, both trackers, the second with `auto-merge: false` and `hook-input`)
- [ ] Blog (`deploy-site-task.yml`, keeping `deploy-site.yml` as its own caller)
- [ ] LanguageTags (`run-codegen-pull-request-task.yml` and its scheduler)
- [x] KiCadLibrary (deletes `build-datebadge-task.yml` and its caller job outright, per TODO.md's retired-badge cleanup, adopting no new stub): deleted in ptr727/KiCadLibrary#59. The change was promoted to `main` in ptr727/KiCadLibrary#65, where the `main` audit run 2026-10-04T01:15:54Z reports no `interface` finding.
Expand Down Expand Up @@ -314,6 +314,8 @@ An operational repo also names its model in the `workflow-model` input, which de

The value is the registry's `workflowModel`, and any value other than `release` runs the rule on a promotion. A caller reaches the input only from a release carrying it. An operational repo whose pin predates one therefore advances the pin before adding the input. The no-build caller snippet passes it. The audit's `interface.workflow-model` check reports an operational caller that passes no `workflow-model: operational`, and a release caller passing any value other than `release`.

A repo whose `validate` hook runs an expensive domain check, such as a firmware compile, can pass its own change-gate result in the `hook-input` input. The hook then skips a change that does not touch the check. It no longer re-derives the event and the diff, a second copy of logic the caller holds. The hook declares `hook-input` as an optional input and reads it as `inputs.hook-input`. A caller reaches the input only from a release carrying it, so its pin advances first.

**Release repos with a smoke build** carry the standard `pull_request` trigger, a `changes` paths-filter job, and a `smoke-build` job. The paths-filter follows WORKFLOW.md D1.1: each of the repo's own targets gets an entry listing that target's own paths. That leaves both docs and `.github/workflows/**` matching nothing and satisfies D1.4 without naming a workflow path at all. The smoke build reaches the hub's `build-release-task.yml` by pin, the same task the repo's own `publish-release.yml` calls. So the repo deletes its copy of `build-release-task.yml` per the `retire` disposition in `spec/divergences.json`. So the repo does not keep one for the smoke leg, per [Adopting the Release Chain][adopting-the-release-chain].

```yaml
Expand Down Expand Up @@ -770,7 +772,7 @@ The caller grants `contents: read` explicitly. This is because the task's own jo
CODEGEN_APP_PRIVATE_KEY: ${{ secrets.CODEGEN_APP_PRIVATE_KEY }}
```

ESPHome-NonRoot carries two trackers today. `check-upstream-version.yml` adopts the stub above as-is. `check-upstream-dependency.yml` adopts a second instance of the same stub with `with: { branches: '["develop"]', bump-branch-prefix: upstream-dependency, auto-merge: false }`. Its bump waits for a human, because its head deliberately does not match a merge-bot rule. `check-upstream-dependency.yml` also adopts a `resolve-upstream` hook shaped around its apt-package snapshot, setting `versions` to `{"docker_base_packages": "<sorted, comma-joined package list>"}` rather than a name-to-version map. The generic title and body this produces read less specifically than today's bespoke "packages added/removed" wording. That is the cost of folding a bespoke tracker into the shared task.
ESPHome-NonRoot carries two trackers today. `check-upstream-version.yml` adopts the stub above as-is. `check-upstream-dependency.yml` adopts a second instance of the same stub with `with: { branches: '["develop"]', state-file: upstream-dependency.json, bump-branch-prefix: upstream-dependency, auto-merge: false, hook-input: dependency }`. Its bump waits for a human, because its head deliberately does not match a merge-bot rule. Its own `state-file` keeps each tracker's bump from rewriting the other's state. Both instances run the repository's one `resolve-upstream` hook, since the task finds the hook at that fixed path. So the hook declares `hook-input` and branches on it. Given `dependency`, it sets `versions` from its apt-package snapshot, to `{"docker_base_packages": "<sorted, comma-joined package list>"}` rather than a name-to-version map. Given no value, it resolves the upstream version as the first tracker does. The generic title and body this produces read less specifically than today's bespoke "packages added/removed" wording. That is the cost of folding a bespoke tracker into the shared task.

**Deploy-site.** A site repo keeps `deploy-site.yml` as a per-repo caller. It has no manifest-wide catalog snippet either. That is because its `uses:` names the hub. It is also because it still carries the dispatch, the ref gate, and the shared validation call. Its `deploy` job nonetheless reaches the hub-hosted `deploy-site-task.yml`. A job calling a reusable workflow cannot itself carry an `environment:` key. [GitHub's supported-keywords list][gh-reusing-workflows] omits it, and GitHub rejects the combination outright. So the caller's `deploy` job carries none. `DEPLOY_SSH_PRIVATE_KEY` still crosses correctly. The task's own `deploy` job binds `environment: ${{ inputs.environment }}` on itself. Per GitHub's own cross-repository behavior, that resolves against the caller's own GitHub Environment store, not the hub's. That behavior is that the `github` context, and an OIDC token's `sub` claim, always attribute the environment to the *caller*. The caller's `secrets: DEPLOY_SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}` line is still required. The task declares this a required `workflow_call.secrets` input, and GitHub rejects a call omitting a required one. But for a secret the environment defines, the value the task's own job sees is governed by the task's own `environment:` binding. It is not governed by anything the caller's own (environment-less) job context could resolve. Confirmed against GitHub's documented reusable-workflow secrets mechanics. Also confirmed with a live cross-repository run against Blog's own `staging` environment ([issue #942][issue-942]). `secrets: inherit` was never the alternative here regardless. It is not used on a cross-repository call at all, per [Secrets and Permissions][secrets-and-permissions], and it would not carry an environment-scoped secret across one either. A required `deploy` hook, `.github/actions/deploy/action.yml`, is invoked three times (`build`, `prune`, `verify`). That is so the site keeps its own generator, precompression, and URL contract while the upload-then-flip sequence stays hub-owned. The hook declares all four inputs the three invocations use between them, `mode`, `bundle-path`, `release-id`, and `environment`. That is because a composite action rejects an invocation that supplies an input it does not declare. That holds even for one a different mode leaves unset. Each invocation also passes the GitHub Environment variables that mode needs as plain `env:` vars. These are `SITE_BASE_URL` to `build` and `verify`, and `DEPLOY_SSH_USER` and `DEPLOY_SSH_HOST` to `prune`. It passes them that way since a composite action's own steps are not guaranteed to read the caller's `vars` context directly. `verify` additionally receives an optional `SITE_AUTH_TOKEN_ID`/`SITE_AUTH_TOKEN` secret pair the same way, forwarded whenever the caller maps it. A site whose live check sits behind its own token-gated auth is the reason it exists. `verify` also receives the `SITE_EXTRA_BASE_URL` variable and an optional `SITE_EXTRA_AUTH_TOKEN_ID`/`SITE_EXTRA_AUTH_TOKEN` pair. They are for a second site the same deploy serves on its own hostname behind its own gate.

Expand Down
Loading
Loading