-
Notifications
You must be signed in to change notification settings - Fork 3
feat!: replace mustache with nunjucks variable rendering #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
…th validation Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
Co-authored-by: FidelusAleksander <63016446+FidelusAleksander@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the GitHub Action to use Nunjucks for variable rendering instead of Mustache.
- Replaces Mustache with Nunjucks in the core logic and updates corresponding dependencies in package.json, action.yml, and documentation.
- Updates tests and CI workflows to verify new Nunjucks features (e.g. conditional content, loops, filters).
Reviewed Changes
Copilot reviewed 12 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/main.js | Core update to use nunjucks.renderString instead of mustache.render. |
| package.json | Dependency change from mustache to nunjucks. |
| action.yml | Metadata description updated to reflect nunjucks usage. |
| tests/test-template.md | New test template showcasing various nunjucks features. |
| tests/sample-template.md | Removed outdated sample template. |
| tests/main.test.js | Test suite updated to verify nunjucks variable rendering and features. |
| README.md | Documentation updated to reference nunjucks. |
| .prettierignore | Updated to ignore test-template file. |
| .github/workflows/ci.yml | CI workflows updated to use the new test template and Nunjucks features. |
| .github/linters/eslint.config.mjs | ESLint ignore patterns updated. |
| .github/linters/.markdown-lint.yml | Markdown lint rules updated. |
| .github/copilot-instructions.md | Instructions updated to reflect nunjucks variable replacement. |
Comments suppressed due to low confidence (1)
src/main.js:47
- The test template uses a 'title' filter, but nunjucks does not register a custom 'title' filter by default. Consider registering a custom 'title' filter in the configuration (e.g., using nunjucks.configure({...}).addFilter('title', value => /* transformation logic */)) to ensure that the filter behaves as expected.
const output = nunjucks.renderString(templateText, templateVars)
arilivigni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the Copilot comment is a nitpick.
LGTM. Great job!
chriswblake
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty good with this. Only a few minor comments about the unit tests.
|
@chriswblake Split the unit tests into multiple files, kept one template for simplicity for now - we can break it down in separate PR if we want Updated test case naming to be more cohesive |

Summary
Important
This will introduce a new major,
v3release ofaction-text-variablesThis pull request introduces significant updates to the repository, transitioning from Mustache to Nunjucks for template rendering, enhancing functionality with advanced templating features, and updating associated workflows, tests, and documentation to reflect these changes. The most important changes include integrating Nunjucks, updating templates and tests, and modifying workflows for improved variable handling.
Breaking changes and migrating
Mustache and nunjucks both support the
{{ variable }}syntax. So for all usages of this action that only used the{{ variable }}syntax, this change should be a drop-in replacement.Mustache and nunjucks differ in the way they support conditional logic, loops and other advanced templating features. Refer to the Nunjucks documentation for more information on how to use these features
In general, Nunjucks offers a broader range of features and is more powerful than Mustache.
Closes: #39
Task list