actions-runtime
Use when writing or reviewing a GitHub Action's pre/main/post entry point on @effected/github-actions — wiring Action.run, ActionRuntime.layer, the ActionServices union, an extra ActionRunOptions.layer, or deciding whether ActionCache, Artifact or GitHubCacheBlobStore belong in the runtime.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 8
- Forks
- 2
01 前言 Front Matter
- name
- actions-runtime
- description
- Use when writing or reviewing a GitHub Action's pre/main/post entry point on @effected/github-actions — wiring Action.run, ActionRuntime.layer, the ActionServices union, an extra ActionRunOptions.layer, or deciding whether ActionCache, Artifact or GitHubCacheBlobStore belong in the runtime.
- when_to_use
- Action.run, ActionRuntime, ActionServices, ActionRunOptions.layer, describeCause, GitHubToken.clientLayer, action entry point, pre/main/post script, isDebug, MinimumLogLevel, RUNNER_DEBUG, stepDebugLogLevel, Effect.logDebug not showing
02 资源文件 3
- 参考文档references/entry-points-and-layers.md12.2 KB
- 参考文档references/failure-rendering.md2.1 KB
- 参考文档references/logging-and-levels.md3.0 KB
03 SKILL.md 正文
Actions runtime
Action.run is the one entry point an action's pre, main and post scripts call — each its own Node process, since GitHub runs the three phases as separate processes with nothing surviving between them except what GITHUB_STATE carries. This skill is the wiring around that call: what ActionServices a program can rely on, how ActionRuntime.layer composes them, how an extra ActionRunOptions.layer widens a program's R, and how a failure gets rendered before the runner sees it.
For the general Effect v4 service/layer rules this package follows — Context.Service, provideMerge vs mergeAll, memoization by reference — see effect-v4-services-layers; this skill carries only the github-actions-specific instance of each.
What you have
| Construct | Import | Reach for it when |
|---|---|---|
Action.run |
import { Action } from "@effected/github-actions" |
wiring a pre/main/post entry point — the only call an entry makes |
ActionServices |
same | typing a program's R so Action.run can run it without a widening error |
ActionRuntime.layer |
same | rarely referenced directly — Action.run composes it; read it to know what's already provided |
ActionRunOptions.layer |
Action.run(program, { layer }) |
a program needs one more service ActionRuntime.layer doesn't already carry |
describeCause / describeError |
import { Action } from "@effected/github-actions" (Action.describeCause) |
rendering a Cause outside Action.run's own top-level catch, in the same one-line convention |
ActionRunOptions.stepDebugLogLevel |
Action.run(program, { stepDebugLogLevel: false }) |
opting out of the default that lowers References.MinimumLogLevel to Debug under RUNNER_DEBUG=1 — rarely |
env.isDebug (a member of ActionEnvironment) |
const env = yield* ActionEnvironment |
branching on step debugging for something other than the log level, such as a spawned tool's verbose flag |
GitHubToken.clientLayer / Repo.layerFromConfig |
import { GitHubToken } from "@effected/github-actions" / import { Repo } from "@effected/github" |
building a client or repo context as an extra layer — both can fail to construct, see Standards |
ActionCache / Artifact / GitHubCacheBlobStore |
import { ActionCache } from "@effected/github-actions" |
caching, artifacts or blob storage — one extra layer line, never a runtime default; see actions-cache-and-artifacts |
Standards
- Read program-level config and inputs through
ActionInput, never a bareConfig.String/Config.Boolean.ActionRuntime.layerinstallsActionInput.layerDefault, which resolves a bare flat name through the runner'sINPUT_derivation before falling back to the ambient lookup, so a side-stepped read no longer resolves to a wrong default underAction.run— but the accessors still own the parsing and the typedConfigErrors the provider cannot supply. Seeactions-inputs-outputsfor the mangling rule and the trap that survives in a suite bypassing the runtime. - Provide
ActionRuntime.layeronce, at the boundary, and let an extra layer's real requirements travel up to it.ActionRunOptions<R>.layeris typedLayer.Layer<R, never, ActionServices>— its third type parameter isActionServices, notnever— so a layer that needsFileSystemorActionOutputsnames that requirement and gets it from the runtime rather than building a private, self-contained sub-provide. - Wrap a layer that can fail to construct with
Layer.orDiebefore handing it toActionRunOptions.layer. The option fixesEatnever.GitHubToken.clientLayerandRepo.layerFromConfigare the two layers in this ecosystem that legitimately can fail to build — treat a missing token or misconfigured repo as fatal at boot, and catch the narrower typed error (GitHubTokenError { reason: "expired" }) instead when a program would rather report an expiry than crash. - Take
ActionCache,ArtifactorGitHubCacheBlobStoreas an explicit one-line extra layer, never expect them fromActionRuntime.layer. They are the only modules that import@azure/storage-blob; excluding them from the default runtime keeps that dependency out of the bundle of every action that merely sets an output. Their ownRis already satisfied by the runtime, so opting in costs exactlyAction.run(program, { layer: ActionCache.layer }). - Let
Action.runown the step-debug log level; do not hand-wire it. UnderRUNNER_DEBUG=1it lowers core'sReferences.MinimumLogLevel(default"Info") to"Debug"for the whole program, and only ever lowers. A leftoverdebug ? "Debug" : "Info"wrapper is redundant under step debugging and raises a caller's lower level when it is off — delete it. Opt out with{ stepDebugLogLevel: false }. - Give every script its own
Action.runcall and its own extra layer. There is noAction.pre/Action.main/Action.post— GitHub runs the three phases as three separate processes, and nothing aboutActionRuntime.layerorAction.runthreads state between them.ActionState/GITHUB_STATEis the only channel that does. - Decode the webhook payload through your own
Schema.ActionEnvironment.payloadhands backunknownafter reading and JSON-parsingGITHUB_EVENT_PATH; do not hand-roll a second read of that file anywhere in a program.
Footguns
- Turning
ActionRuntime.layerinto a function instead of a bound constant rebuilds the environment snapshot at every composition site — layers memoize by reference, not by structure. Seereferences/entry-points-and-layers.md. - A rejecting entry point produces a failed step and an unhandled rejection, and only the first is legible in a workflow log —
Action.runnever rejects by design; do not wrap it in atry/catchthat could swallow the resolvedPromise. Seereferences/entry-points-and-layers.md. yield* ActionEnvironment.isDebugdoes not compile and readsundefinedat runtime —isDebugis a member of the service, soconst env = yield* ActionEnvironmentfirst, thenyield* env.isDebug. Seereferences/logging-and-levels.md.Effect.logDebugstays invisible under step debugging only when the program opted out (stepDebugLogLevel: false), provides its own higherMinimumLogLevel, or runs outsideAction.run— a test or a hand-composed runtime gets core's"Info"default.- A
postscript that lets an unrendered defect escapeAction.run's top-level catch produces a green step for a crashed action, the worst outcome the last-resort catch exists to prevent. Seereferences/failure-rendering.md.
Additional resources
- references/entry-points-and-layers.md — the full
Action.runcontract, theActionServicesunion,ActionRuntime.layer's exact composition andprovideMergechain, the two config providers,ActionRunOptions.layer's widening behavior, and thepre/main/postentry shapes. Load when: composing a runtime layer, debugging why a service isn't resolving, or writing a new entry script. - references/failure-rendering.md — the canonical home for
describeCause/describeError: the one-line rendering convention, the::error::/::debug::depth split, and the last-resort catch aroundEffect.runPromise. Load when: a failure needs rendering anywhere outsideAction.run's own catch, or reviewing why a run reported green after a crash. - references/logging-and-levels.md — how
Action.runlowersMinimumLogLevelunder step debugging (only-lowers, run-wide, the opt-out), why a hand-wired wrapper should be deleted, and readingisDebugoff the service. Load when:Effect.logDebugcalls aren't showing up withRUNNER_DEBUGset, or a program carries its own log-level wrapper.
04 同仓库更多 Skills
testing-actions
Use when writing or reviewing tests for @effected/github-actions, @effected/github, @effected/sbom or @effected/commands — stubbing the GitHub API, writing a service's layerTest or makeTest double, testing the pre/main/post lifecycle through Action.run, or debugging why a test hits the real network or hangs.
supply-chain-attestation
Use when generating a CycloneDX SBOM, checking NTIA minimum elements, building an in-toto statement or a SLSA provenance predicate, signing into a Sigstore DSSE bundle, or uploading an attestation to GitHub.
structuring-an-action
Use when laying out a new GitHub Action repository on the @effected suite, deciding where a piece of code belongs (an entry point, a step, a shared service, a shim), or reviewing an existing action's file structure against the canonical shape.
running-commands-and-tools
Use when running a subprocess in Effect v4, spawning a command, capturing stdout/stderr/exit code, checking whether a CLI tool is installed or which copy to run, running a package-manager script through the project's launcher, detaching a background process, or redacting a secret from argv or captured output.
release-and-publish
Use when publishing a package to npm, reading the npm registry from Effect v4, checking whether a version is already published, cutting a release tag or GitHub release from an action, applying a release-age gate, or deriving tracking tags for GitHub Actions distribution.
hardening-a-parser-port
Use when porting or writing a recursive-descent parser, lexer, or tree-walker over untrusted text in the @effected monorepo — the class of hardening the cloud reviewer scans for on every migration. Covers stack-overflow depth guards (on EVERY recursion surface, which a facade has N of — not two), numeric bound guards that must reject NaN and non-integers, code-point range checks scoped to formats with wide escapes, prototype-pollution, control-character rejection, and the invariant that malformed input must fail through the typed error channel, never as an unhandled defect.