Problem
Both shared composite actions — actions/publish-docs and actions/publish-single-page-docs — shell out to the gh CLI in their publishing steps:
- resolving the release tag when
release-tag is not given (gh api repos/…/releases/latest, then gh api repos/…/releases?per_page=1)
- attaching the artifact (
gh release upload … --clobber)
- notifying a deployment repository (
gh api repos/…/dispatches --method POST, publish-docs only)
gh is preinstalled on GitHub-hosted runners but is not part of the runner itself. On a self-hosted runner without it the upload step fails with gh: command not found after the artifact has already been built, and the consuming repo has no way to fix that short of provisioning the CLI on every runner.
The actions should not assume anything about the runner image beyond what the runner guarantees.
Proposal
Replace every gh invocation with actions/github-script, which ships its own Node runtime and an authenticated Octokit client:
- release lookup →
repos.getLatestRelease / repos.listReleases / repos.getReleaseByTag
- upload with clobber → delete any existing
kb-docs.tar.gz asset, then POST to the release's upload_url (so GitHub Enterprise upload hosts work too, instead of a hard-coded uploads.github.com)
- notify →
repos.createDispatchEvent, still non-fatal
Keep all consumer-controlled values flowing through env, never interpolated into the script body (same rule as #55). Pin actions/github-script by commit SHA like the other actions.
The remaining run: steps (npm ci, node …/src/index.js) are single commands and stay on shell: bash; document that bash and network access to the GitHub API are the only runner requirements, since Node comes from actions/setup-node.
Related: scripts/fetch-apps.js falls back to gh api when GITHUB_TOKEN is unset. The reusable build-image.yml workflow should default the token to github.token so a deployment that omits docs-token (public docs repos) does not hit that fallback on a runner without gh, and the fallback itself should say what to do when gh is missing.
Acceptance
Problem
Both shared composite actions —
actions/publish-docsandactions/publish-single-page-docs— shell out to theghCLI in their publishing steps:release-tagis not given (gh api repos/…/releases/latest, thengh api repos/…/releases?per_page=1)gh release upload … --clobber)gh api repos/…/dispatches --method POST,publish-docsonly)ghis preinstalled on GitHub-hosted runners but is not part of the runner itself. On a self-hosted runner without it the upload step fails withgh: command not foundafter the artifact has already been built, and the consuming repo has no way to fix that short of provisioning the CLI on every runner.The actions should not assume anything about the runner image beyond what the runner guarantees.
Proposal
Replace every
ghinvocation withactions/github-script, which ships its own Node runtime and an authenticated Octokit client:repos.getLatestRelease/repos.listReleases/repos.getReleaseByTagkb-docs.tar.gzasset, thenPOSTto the release'supload_url(so GitHub Enterprise upload hosts work too, instead of a hard-codeduploads.github.com)repos.createDispatchEvent, still non-fatalKeep all consumer-controlled values flowing through
env, never interpolated into the script body (same rule as #55). Pinactions/github-scriptby commit SHA like the other actions.The remaining
run:steps (npm ci,node …/src/index.js) are single commands and stay onshell: bash; document that bash and network access to the GitHub API are the only runner requirements, since Node comes fromactions/setup-node.Related:
scripts/fetch-apps.jsfalls back togh apiwhenGITHUB_TOKENis unset. The reusablebuild-image.ymlworkflow should default the token togithub.tokenso a deployment that omitsdocs-token(public docs repos) does not hit that fallback on a runner withoutgh, and the fallback itself should say what to do whenghis missing.Acceptance
ghinvocation inactions/**/action.ymlactions/github-scriptpinned by SHAbuild-image.ymlno longer depends onghwhendocs-tokenis omitted