$ show actions/github-script
actions/github-script is a GitHub Action that allows users to run JavaScript/TypeScript scripts in their workflows with access to a pre-authenticated GitHub API client and other GitHub Action toolkit packages. The action executes user-provided scripts as asynchronous functions within a context that includes github, context, core, glob, io, exec, getOctokit, and require objects. Scripts can make GitHub API calls, perform file operations, and return values that become action outputs. The architecture follows standard GitHub Action patterns with TypeScript source code compiled and bundled via ncc into a single distributable file. Key components include async-function.ts for safely executing user scripts, create-configured-getoctokit.ts for creating secondary authenticated clients with inherited configuration, and wrap-require.ts for handling module resolution. The action integrates with GitHub's retry and request-logging plugins and supports configurable retries, user-agent, base URL, and result encoding.
The LLM identified 3 files worth highlighting for reuse:
Implements callAsyncFunction which creates an async function from a string and executes it with provided context arguments. This isolated utility enables safe execution of user-provided scripts with dependency injection, demonstrating non-obvious skill in handling async function creation from strings and proper context passing. The component is highly reusable in any context requiring dynamic script execution with controlled scope.
Creates a wrapped getOctokit function that inherits default options (retries, request logging, user agent) while allowing user overrides. Demonstrates excellent craftsmanship in deep-merging request/retry options, stripping undefined values to prevent default clobbering, and deduplicating plugins. This solves the recurring problem of creating secondary authenticated clients with consistent configuration and could be extracted to any project using Octokit with minimal modification.
Implements a Proxy around Node's require function to handle relative path resolution and npm package imports from the current working directory. This addresses a specific challenge in GitHub Actions where scripts need to require local files and installed dependencies. The component shows strong understanding of Node.js module resolution and Proxy usage, making it reusable in any environment requiring enhanced require functionality with path resolution.