-
Notifications
You must be signed in to change notification settings - Fork 15
add template engine functionality to support generic templates #262
Conversation
fe216b4
to
5ddc3be
Compare
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.
Is the sync-release-assets
the only use case for this?
It seems like this could be easier accomplished by just publishing a GH Actions Workflow and manually calling this workflow from the two (?) repos that care about it, no?
.github/workflows/copy-workflow.yml
Outdated
# replace $default-branch with this repo's GitHub default branch | ||
sed -i "s:\$default-branch:${{ env.DEFAULTBRANCH }}:g" $tmp | ||
# replace template contexts with values from the JSON context object | ||
perl -pi -e "s#$regexp#$replacement#ge" $tmp |
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.
Co-authored-by: Marten Seemann <[email protected]>
It is a concrete example that I decided to use when working on templating functionality but it is not the only use case. Deploying issue templates is another example that was mentioned here #57
Yes, it is possible to manually copy the workflow file to interested repositories to achieve the same but I believe it is a pretty good fit for this repository to be the one distributing it. At the moment there are only 2 but I think there might be more to come. @lidel might be able to elaborate on this. |
e06792e
to
676e490
Compare
This comment was marked as outdated.
This comment was marked as outdated.
2 notes:
|
That's expected and that's fine for what it's trying to be right now.
I think if we ever need to develop the functionality further, we should consider alternatives. I've been able to simplify the setup by moving the config to |
Template engine
I created a README.md that describes the template engine from the end user perspective i.e. what the syntax is, what objects are available, etc.
On the backend, I use perl to:
\${{{(.?*)}}}
;Extra files
The newly added
extra_files
config field can be used to request copying of extra files while not modifying thefiles
value fromdefaults
.Use-case example
See #434
Testing
.github-test-target
from testing: dispatch + copy-workflow + PR