github-script is a GitHub Action that runs an asynchronous JavaScript function body in a workflow with a pre-authenticated Octokit client and workflow context.
Overview
Workflow authors supply a script input containing the body of an async JavaScript function. At runtime the action injects github as an Octokit REST client with pagination, context with workflow run metadata, getOctokit to mint additional authenticated clients, and a wrapped require that resolves npm packages and relative files from the working directory.
Scripts can call GitHub REST, GraphQL, and request APIs, read step outputs, pass data through environment variables instead of inline expressions to reduce injection risk, and return JSON or string results exposed as step outputs via result-encoding. Retries on failed REST calls are configurable, with defaults skipping typical client-error status codes.
Version 9 upgrades to current Octokit typings, injects getOctokit for multi-token workflows, and runs on Node 24 with a minimum runner version requirement documented in the release notes. Older patterns that required @actions/github inside the script should migrate to the injected client and getOctokit helper.
Examples in the documentation cover commenting on issues, labeling, welcoming contributors, downloading URLs, running separate repository JavaScript modules after checkout, using ESM with type module in package.json, and executing shell commands through @actions/exec.
Key features
- Pre-authenticated Octokit github client
- Workflow context object
- getOctokit extra token clients
- Wrapped require for npm modules
- JSON or string result outputs
- Configurable REST retries
- GraphQL query support
- External script file workflows
Use cases
- Automate issue comments in CI
- Apply labels from workflow events
- Custom API calls mid-pipeline
- Cross-repository token operations
- Reuse shared workflow JavaScript