Implement TypeScript-based GitHub Action for template processing with YAML data#1
Draft
Implement TypeScript-based GitHub Action for template processing with YAML data#1
Conversation
Co-authored-by: mellolucas <54722857+mellolucas@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Create a GitHub action that receives inputs for data-path as string, template-syntax as string, template-repo as string, template-branch as string, template-tag as string, template-path as string, recurse as Boolean, output-type as string, output-path ...
Implement TypeScript-based GitHub Action for template processing with YAML data
Aug 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements a complete GitHub Action that generates context-aware files from templates using YAML data as the source of truth. The action supports multiple template syntaxes, complex data structures, and various output options.
Key Features
Template Processing:
{{ }}), Shell (${ }), and ERB/Ruby (<%= %>)Data Source Flexibility:
Array Handling:
The action implements sophisticated array processing:
Arrays are automatically expanded by duplicating template lines, with primitive arrays replaced directly and object arrays converted to indexed placeholders for further processing.
Output Options:
Implementation Details
The action is built with modern TypeScript and uses:
@actions/coreand@actions/githubfor GitHub Actions integration@octokit/restfor authenticated GitHub API callsjs-yamlfor YAML parsingmustachefor template rendering@vercel/nccfor building a single distributable fileThe core algorithm processes placeholders in depth-order iterations, ensuring that nested structures are handled correctly and arrays are properly expanded before processing their contained elements.
Usage Example
This implementation provides a robust foundation for template-based file generation workflows, enabling teams to maintain centralized configuration data while generating context-specific files across different environments and use cases.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.