Skip to content

Commit 4010793

Browse files
Add destination path templating for create-mode prs (#490)
Useful for super polymorphic automations where you need to parameterize filepaths
1 parent 8b56b73 commit 4010793

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/pr/creates.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ func applyCreates(creates *CreateSpec, ctx map[string]interface{}) error {
1515
source = filepath.Join(creates.ExternalDir, source)
1616
}
1717

18-
if err := replaceTo(source, tpl.Destination, func(data []byte) ([]byte, error) {
18+
destPath := []byte(tpl.Destination)
19+
dest, err := templateReplacement(destPath, ctx)
20+
if err != nil {
21+
dest = destPath
22+
}
23+
24+
if err := replaceTo(source, string(dest), func(data []byte) ([]byte, error) {
1925
return templateReplacement(data, ctx)
2026
}); err != nil {
2127
return err

0 commit comments

Comments
 (0)