--- name: actions description: >- Use when building, extending, reviewing or testing a GitHub Action, a release or npm publish pipeline, or any Effect v4 program that calls the GitHub API: inputs and outputs, job summaries, check runs, caches, artifacts, tokens, SBOMs and attestations. --- # GitHub Actions and the GitHub API An action-shaped program on the kit uses five `@effected` packages: - `@effected/github-actions`: the runner. - `@effected/github`: the GitHub API. - `@effected/commands`: subprocesses and tool discovery. - `@effected/npm`: registry reads and publishing. - `@effected/sbom`: SBOM, in-toto, SLSA and Sigstore. Two more sit beside them. `@effected/schemastore` is a runtime dependency: the action reads its output contract's `HostedSchema` from it to write `$schema`. `@effected/plugin` is a devDependency: its `effected action build` bundles the action, and its `effected schema build` and `check` publish and drift-test the JSON Schema. **`@effected/github` talks to the GitHub API, and `@effected/github-actions` talks to the runner it runs inside.** Nothing in `github-actions` reads `process.env.GITHUB_REPOSITORY` for `github`, and nothing in `github` writes a workflow command. They meet at two seams, both in `github-actions`: the `GitHubToken` bridge and `ActionLogger.logger`, which maps `Effect.log*` onto workflow commands. ## Look it up before you write it Find the capability's row in [the capability map](references/capabilities.md) before you write the code. For a need no row names, grep the kit's construct index by what you want done: ```bash grep -ri "" "{{skill_dir effected-packages}}/references/constructs/" ``` A runner capability built by hand on `process.env` or `@actions/*` skips the typed errors, the masking and the test doubles the kit ships. For a capability outside these packages, such as globs, semver, lockfiles, YAML or git, read the `effected-packages` skill before you write it. ## Rules for every task - **Resolve an API claim in order:** the package's own `CLAUDE.md`, then its source. The source wins when they disagree. For Effect core, the vendored source settles existence and signature, and a probe settles behaviour. - **The route is the key.** `client.request("GET /repos/{owner}/{repo}", …)` types the parameters and the response from the literal alone. A cast in GitHub API code is a defect. - **Read an input through `ActionInput`, never a bare `Config.*` read.** `ActionInput.string("x")` owns the `INPUT_` derivation and the typed `ConfigError`s. A test that injects its own `ConfigProvider` around a bare read can drift from the runner's key derivation. - **A consumer program never mentions the platform.** `ActionRuntime.layer` composes the platform and the HTTP client with no requirements of its own. Never hand-compose a `MainLive`. - **Every service ships `makeTest` and `layerTest` on the service itself.** There is no `./testing` subpath. An unstubbed member dies loudly and names itself. - **Check an error's shape before you write its handler.** Most errors carry a `kind` or `reason` field to match on. `ActionOutputError`, `BlobEnvelopeError`, `CacheKeyError` and `DetachedProcessError` are unions of one class per failure: match them on `_tag`, with `Effect.catchTag`. Every error reason has a test that fires it. - **`@effected/github-actions` is the one package with a required Node platform peer**, and the only one where a raw `node:` import is sanctioned. Everything that can go through a core contract still does. - **Heavy engines stay confined, and a reachability test proves it.** The blob transport lives in three modules, Sigstore in one and octokit in `@effected/github`. Never gather an engine into a namespace object, a shared helper or a default runtime. - **The kit ships no `@actions/*` package, no rate limiter, no ANSI colour API and no per-resource error class.** It does ship `GitHubMarkdown`, the GFM writer, so never hand-roll a markdown writer. [The capability map](references/capabilities.md) lists every absence and what to use instead. ## Pages Read the topic page for the work in front of you. Each one names its deeper pages with a condition for reading them, and [the index](references/index.md) lists all of them on one line each. Grep the index for what you are about to do when no row below fits. | Page | Load when | | :-- | :-- | | [capabilities.md](references/capabilities.md) | Deciding which package and page own a capability, a call sequence such as sign-and-attest or publish, or whether the kit ships something at all | | [designing.md](references/designing.md) | Designing a new action, rebuilding or porting one onto the kit, or planning any multi-step action build, before the spec or any module | | [structuring.md](references/structuring.md) | Laying out an action repository, deciding where a piece of code belongs (entry, step, service, shim), or reviewing a layout | | [action-build.md](references/action-build.md) | Running `effected action init` or `effected action build`, the `[action]` tables, `persistLocal`, `--check`, or a local-only action | | [runtime.md](references/runtime.md) | Writing a pre, main or post entry point: `Action.run`, `ActionRuntime.layer`, `ActionServices`, `Checkout`, failure rendering, debug logging | | [inputs-outputs.md](references/inputs-outputs.md) | Reading inputs through `ActionInput`, writing outputs through `ActionOutputs`, or a schema-backed output contract | | [reporting.md](references/reporting.md) | Workflow-command logs, annotations, a job summary, a check run, a sticky pull-request comment, or a managed document | | [state-and-secrets.md](references/state-and-secrets.md) | `ActionState` across phases, a `Redacted` secret, `DryRun`, a `BlobEnvelope`, or reaping a detached child process | | [cache-and-artifacts.md](references/cache-and-artifacts.md) | Caching a directory, uploading or downloading an artifact, a tool or package-manager install, or a keyed blob store | | [github-api.md](references/github-api.md) | Calling GitHub's REST or GraphQL API: `client.request`, pagination, `GitBranch` or `GitTag` upserts, `GitHubError` | | [github-app-tokens.md](references/github-app-tokens.md) | A client from a plain token or a GitHub App, an installation token cache, or `GitHubToken` across the three phases | | [release-and-publish.md](references/release-and-publish.md) | Publishing to npm, reading the registry, release tags and GitHub releases, a release-age gate, or a changeset bump for a changed error type | | [supply-chain-attestation.md](references/supply-chain-attestation.md) | A CycloneDX SBOM, NTIA elements, an in-toto statement or SLSA provenance, Sigstore signing, or an attestation upload | | [testing.md](references/testing.md) | Testing an action or GitHub API code: `makeTest` and `layerTest` doubles, the scripted octokit harness, the lifecycle through `Action.run`, a test that hits the network or hangs | The general Effect v4 rules these pages sit on, such as schema design, services and layers, idioms and testing, are in the `effect` and `effect-testing` skills. These pages carry only the GitHub-specific instances. A fresh copy of the action template is turned into a planned action by the user-invoked `bootstrapping-an-action` skill, which hands off to the `action-engineer` agent.