Add GitHub Actions to configuration and generate TypeScript files.
dotgithub add <orgRepoRef...> [options]The add command downloads GitHub Actions from their repositories and generates TypeScript wrapper classes with full type safety. This allows you to use GitHub Actions in your workflows with IntelliSense support and compile-time type checking.
<orgRepoRef...>- One or more GitHub repository references (e.g.,actions/checkout@v4,actions/setup-node@v4)
--output <outputDir>- Output directory for generated TypeScript files (uses config default if not specified)-t, --token <token>- GitHub token (overrides env GITHUB_TOKEN)--no-sha- Use the original ref instead of resolving to SHA--name <name>- Override the action name for type names and function names (e.g.,setupNode)
dotgithub add actions/checkout@v4dotgithub add actions/checkout@v4 actions/setup-node@v4 actions/setup-python@v5dotgithub add actions/setup-node@v4 --name setupNodedotgithub add actions/checkout@v4 --output ./custom-actionsdotgithub add actions/checkout@v4 --no-sha- Downloads action metadata - Fetches the
action.ymlfile from the specified repository and ref - Resolves references - Converts version tags (like
v4) to specific commit SHAs for reproducibility - Generates TypeScript classes - Creates type-safe wrapper classes with:
- Input type definitions
- Output type definitions
- Proper method signatures
- JSDoc documentation
- Updates configuration - Adds the action to your
dotgithub.jsonfile - Creates index files - Generates organization-level index files for easy importing
For each action, the command generates:
- Action class file - TypeScript class extending
ActionConstruct - Type definitions - Input and output type interfaces
- Organization index - Aggregated exports for the organization
- Root index - Main exports file
Actions are specified in the format: org/repo@ref
org- GitHub organization or usernamerepo- Repository nameref- Git reference (tag, branch, or commit SHA)
Examples:
actions/checkout@v4- Latest v4 tagactions/setup-node@v4.1.0- Specific versionactions/checkout@main- Latest from main branchactions/checkout@abc1234- Specific commit SHA
Generated actions can be used in your TypeScript code:
import { Actions } from './actions/index.js';
const { checkout, setupNode } = new Actions(stack, 'actions');
// Type-safe usage with IntelliSense
checkout('Checkout code', {
'fetch-depth': 1,
submodules: 'recursive',
}).toStep();The command requires a GitHub token for:
- Accessing private repositories
- Higher rate limits for public repositories
Set your token via:
- Environment variable:
GITHUB_TOKEN - Command option:
--token <token>
The command will fail if:
- The repository doesn't exist
- The specified ref doesn't exist
- The repository doesn't contain a valid
action.yml - Network connectivity issues
- Invalid action reference format
- dotgithub list - List tracked actions
- dotgithub remove - Remove actions
- dotgithub update - Update action versions
- dotgithub regenerate - Regenerate action files