repo-file-sync-action
repo-file-sync-action copied to clipboard
Include `repo` object when templating
This change adds the repo
object to every Nunjucks context for easier bulk templating.
The way templating is currently defined makes it very verbose to template several repos, especially when trying to do relatively simple templating like injecting the repo name. We'd effectively need:
# sync.yml
user/repo1:
- source: src/README.md
template:
user: user
repo: repo1
user/repo2:
- source: src/README.md
template:
user: user
repo: repo2
...
# README.md
Hello from {{ repo }} by {{ user }}!
By pre-populating the context with the repo object we are able to simplify it and do the following instead:
# sync.yml
group:
- repos: |
user/repo1
user/repo2
...
files:
- source: src/README.md
template: true
# README.md
Hello from {{ repo.name }} by {{ repo.user }}!
@BetaHuhn will you have time to review this soon?