Regenerate TypeScript files based on the config.
dotgithub regenerate [pattern] [options]The regenerate command recreates TypeScript files for tracked GitHub Actions based on your current configuration. This is useful when you need to refresh generated files, apply formatting changes, or recover from file corruption.
[pattern]- Optional glob pattern to filter actions (e.g.,"actions/*"or"*/checkout")
-t, --token <token>- GitHub token (overrides env GITHUB_TOKEN)--prune- Remove orphaned files not defined in config
dotgithub regenerateRegenerates TypeScript files for all tracked actions.
dotgithub regenerate "actions/*"Regenerates only actions from the actions organization.
dotgithub regenerate --pruneRegenerates all actions and removes orphaned files not in the configuration.
dotgithub regenerate -t ghp_xxxxxxxxxxxxUses a specific GitHub token for regeneration.
- Reads configuration - Loads actions from
dotgithub.json - Filters actions - Applies pattern filter if specified
- Downloads metadata - Fetches action.yml files from GitHub
- Generates TypeScript - Creates type-safe wrapper classes
- Formats code - Applies Prettier formatting
- Updates index files - Regenerates organization and root index files
- Cleans up - Removes orphaned files if
--pruneis used
The pattern argument uses glob syntax to filter actions:
"actions/*"- All actions from theactionsorganization"*/checkout"- All checkout actions from any organization"actions/setup-*"- All setup actions from theactionsorganization"*"- All actions (same as no pattern)
For each action, the command:
- Downloads action.yml - Fetches the latest action definition
- Generates types - Creates TypeScript interfaces for inputs/outputs
- Creates wrapper class - Generates ActionConstruct subclass
- Adds imports - Includes necessary DotGitHub imports
- Formats code - Applies consistent formatting with Prettier
- Writes file - Saves to the configured output path
The command also regenerates:
- Organization index files -
actions/orgName/index.ts - Root index file -
actions/index.ts - Action construct classes - Aggregated action classes
When using --prune, the command:
- Identifies expected files - Based on configuration
- Scans output directory - Finds all TypeScript files
- Removes orphaned files - Deletes files not in configuration
- Cleans empty directories - Removes empty organization directories
The command provides detailed progress information:
Regenerating 3 action(s)...
Regenerating actions/checkout...
✓ Generated src/actions/actions/checkout.ts
Regenerating actions/setup-node...
✓ Generated src/actions/actions/setup-node.ts
Regenerating actions/setup-python...
✓ Generated src/actions/actions/setup-python.ts
✓ Regenerated org index for actions
Successfully regenerated 3 action(s)
Use this command to:
- Recover from corruption - Fix corrupted or missing files
- Apply formatting - Update code formatting standards
- Refresh types - Get latest type definitions
- Clean up project - Remove unused files with
--prune - Debug issues - Regenerate files to resolve problems
- Update after config changes - Apply configuration modifications
The command handles various error scenarios:
Regenerating actions/checkout...
✓ Generated src/actions/actions/checkout.ts
Regenerating actions/invalid-action...
✗ Failed to regenerate actions/invalid-action: Repository not found
No actions found in config file
No actions match pattern "invalid-pattern"
Requires GitHub token for:
- Accessing private repositories
- Higher rate limits
- Downloading action metadata
Set via:
- Environment variable:
GITHUB_TOKEN - Command option:
--token <token>
Regeneration performance depends on:
- Number of actions to regenerate
- Network speed for downloading metadata
- File I/O operations
- Code formatting with Prettier
Use patterns to regenerate only specific actions for faster iteration.
- Use patterns for efficiency - Regenerate only what you need
- Regular pruning - Use
--pruneperiodically to clean up - Version control - Commit regenerated files
- Test after regeneration - Verify everything still works
- Backup before pruning - Be careful with
--pruneon important projects
- dotgithub add - Add new actions
- dotgithub update - Update action versions
- dotgithub remove - Remove actions
- dotgithub list - See tracked actions
- dotgithub add - Add GitHub Actions to your project
- dotgithub update - Update action versions
- dotgithub remove - Remove actions from tracking
- Configuration Guide - Understanding dotgithub.json