feat: add tera filter for ordered commit groups#339
Conversation
|
Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️ |
|
This looks good, the question is how can we naturally support this in a non-breaking way. As far as I understood, the user needs to use |
|
Yea idea of the non-breaking path is to require a different filter. The current |
|
Cool, how far are we from implementing that? I'm not sure if I quite understood the contents of this PR - are you planning to make that happen? |
|
It's def not done in the PR yet. You can see the test case for a lil peek at what the PR currently does. The goal is: - {% for group, commits in commits | group_by(attribute="group") %}
+ {% for group, commits in commits | commit_groups %}I'm not 100% sure if it's possible to do it without extra args to the new filter yet. |
|
I looked into Tera internals and I don't think it is possible to pass an argument to a filter. But as a workaround we can use a static global variable. I took a stab at this at Let me know if you think this is applicable and we can work on polishing the implementation. |
|
ping 🐻 |
|
closing for now, I might come back to this in the future |
Description
Add a Tera filter that produces commit groups, with order determined by
commit_parsersconfig.At least, that is the end goal, the PR does not yet achieve this. It's definitely a mess but I'd like some feedback on the overall goal before progressing further.
Motivation and Context
Using
group_by(attribute="group")may not produce desired behavior if order of changelog section matters, eg. "Features" before "Bug Fixes".As far as I can tell, the most sensible place to source the ordering details is the
commit_parsersconfig (it's what I initially tried to force sections to be ordered differently). It's not wired up like that yet, but hopefully this half of the task shows that it can be done.How Has This Been Tested?
A new integration test has been added showing that ordering of sections is definable and not accidentally determined by the hash in a regular map.
Screenshots / Logs (if applicable)
Types of Changes
Checklist: