How actions/ai-inference works
This GitHub Action turns inline or file-based prompts into Copilot CLI requests, then exposes the model response as both an action output and a persistent temporary file. The main workflow is orchestrated by src/main.ts; prompt parsing and CLI execution are distinct stages, with src/helpers.ts providing legacy prompt loading, message assembly, and process-exit support. The README also documents YAML templates, file-backed variables, system prompts, and optional tool permissions. Edges reflect the shown calls and README workflow; unsampled action wiring is not inferred.
Main entry points: main.ts Action orchestrator · copilot.ts Copilot CLI adapter · index.ts Action entrypoint · prompt.ts Prompt YAML parser
Components 13
Action workflow
- Action entrypoint
src/index.ts - Action orchestrator
src/main.ts - Action inputs and outputs
action.yml - Action outputs
src/main.ts - Response temp file
src/main.ts
Prompt preparation
- Prompt YAML parser
src/prompt.ts - Template variables
src/prompt.ts - Legacy prompt helpers
src/helpers.ts - Message assembly
src/helpers.ts
Copilot inference
- Copilot CLI adapter
src/copilot.ts - Copilot CLI
Other components
- Workflow author
- GitHub Actions runner
Connections 14
- Workflow author → Action inputs and outputs: configures
README.md - GitHub Actions runner → Action entrypoint: runs
src/index.ts - Action entrypoint → Action orchestrator: starts
src/index.ts - Action orchestrator → Prompt YAML parser: loads YAML
src/main.ts - Action orchestrator → Template variables: parses variables
src/main.ts - Prompt YAML parser → Template variables: substitutes
src/prompt.ts - Action orchestrator → Legacy prompt helpers: loads legacy inputs
src/main.ts - Action orchestrator → Message assembly: builds messages
src/main.ts - Action orchestrator → Copilot CLI adapter: requests inference
src/main.ts - Copilot CLI adapter → Copilot CLI: spawns
src/copilot.ts - Copilot CLI adapter → Action orchestrator: returns response
src/main.ts - Action orchestrator → Action outputs: sets response
src/main.ts - Action orchestrator → Response temp file: writes response
src/main.ts - Action outputs → GitHub Actions runner: exposes outputs
README.md