Skip to content

Conversation

@FidelusAleksander
Copy link
Contributor

@FidelusAleksander FidelusAleksander commented Jun 26, 2025

Summary

Important

This will introduce a new major, v3 release of action-text-variables

This 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

  • For workflow changes, I have verified the Actions workflows function as expected.
  • For content changes, I have reviewed the style guide.

Copilot AI and others added 8 commits June 25, 2025 13:55
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>
Copilot AI review requested due to automatic review settings June 26, 2025 09:40
@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request maintenance Maintenance in the repository labels Jun 26, 2025
@FidelusAleksander FidelusAleksander changed the title Feature/nunjucks variables feat!: replace mustache with nunjucks variable rendering Jun 26, 2025

This comment was marked as outdated.

@FidelusAleksander FidelusAleksander added bump-major Corresponds to major SemVer release breaking Introduces Breaking Changes labels Jun 26, 2025
Copy link
Contributor

Copilot AI left a 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)

@FidelusAleksander FidelusAleksander removed documentation Improvements or additions to documentation maintenance Maintenance in the repository labels Jun 26, 2025
Copy link
Collaborator

@arilivigni arilivigni left a 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!

Copy link
Member

@chriswblake chriswblake left a 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.

@github-actions github-actions bot added documentation Improvements or additions to documentation maintenance Maintenance in the repository labels Jun 27, 2025
@FidelusAleksander
Copy link
Contributor Author

@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

image

@FidelusAleksander FidelusAleksander merged commit e5afbb4 into main Jun 27, 2025
21 checks passed
@FidelusAleksander FidelusAleksander deleted the feature/nunjucks-variables branch June 27, 2025 14:13
@FidelusAleksander FidelusAleksander removed documentation Improvements or additions to documentation maintenance Maintenance in the repository labels Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Introduces Breaking Changes bump-major Corresponds to major SemVer release enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

[Feature] Restructure the action to support nunjucks instead of mustache variables

4 participants