Skip to content
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

Add support for compiling Jinja-style templates in sync process #271

Merged
merged 6 commits into from
Nov 17, 2022

Conversation

dhruvkb
Copy link
Contributor

@dhruvkb dhruvkb commented Nov 12, 2022

Sometimes a single file must be synced to different repositories with small differences. This PR allows files to be marked as templates which are then rendered using Nunjucks instead of simply being copied over as-is.

@BetaHuhn
Copy link
Owner

Hey @dhruvkb, thanks for taking the time to create this PR!

I wanted to add support for templates for a while (#204) but never had the time to work on it so far.

Any specific reasons for going with Nunjucks as the template engine instead of others like mustache, Handlebars or one of the many others?

@dhruvkb
Copy link
Contributor Author

dhruvkb commented Nov 14, 2022

To be honest, it was largely a subjective choice. I come from a Python background where Jinja is like the gold standard so Nunjucks made sense. If you have a strong preference for an alternative template engine, I think it'll be a small change and I'll be happy to update the PR.

The other alternative I considered was Pug but that seemed very specifically aimed for HTML templates.

@dhruvkb
Copy link
Contributor Author

dhruvkb commented Nov 17, 2022

@BetaHuhn is something needed from my end to get this PR merged? We'd like to use templates in our repos so we're eagerly looking forward to a release that includes this feature.

@BetaHuhn
Copy link
Owner

To be honest, it was largely a subjective choice. I come from a Python background where Jinja is like the gold standard so Nunjucks made sense. If you have a strong preference for an alternative template engine...

Makes sense. No strong opinions on my side, was just curious :)

Is something needed from my end to get this PR merged?

@dhruvkb No, was just too busy to actually review the changes. Will take a look now.

Copy link
Owner

@BetaHuhn BetaHuhn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the README to make it easier for people not familiar with Jinja or Nunjucks. Otherwise everything looks good.

Thanks again for the PR @dhruvkb!

@BetaHuhn BetaHuhn merged commit a2677cb into BetaHuhn:master Nov 17, 2022
@BetaHuhnBot
Copy link
Collaborator

🎉 This PR is included in version 1.18.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

ChrisCarini pushed a commit to ChrisCarini/repo-file-sync-action that referenced this pull request Dec 27, 2022
…nc process (BetaHuhn#271)

* Add `nunjucks` and update `@actions/core`

* Read template info from YAML config file

* Render templates when copying files

* Compile JS files into action

* Add documentation about the templating feature

* update readme

Co-authored-by: Maximilian Schiller <schiller@mxis.ch>
ChrisCarini pushed a commit to ChrisCarini/repo-file-sync-action that referenced this pull request Dec 27, 2022
…nc process (BetaHuhn#271)

* Add `nunjucks` and update `@actions/core`

* Read template info from YAML config file

* Render templates when copying files

* Compile JS files into action

* Add documentation about the templating feature

* update readme

Co-authored-by: Maximilian Schiller <schiller@mxis.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants