2024-06-04 17:28:12 +02:00
|
|
|
import Handlebars from "handlebars";
|
|
|
|
|
2024-06-04 17:44:31 +02:00
|
|
|
export function renderPullRequestBody(template: string): string {
|
|
|
|
const tpl = Handlebars.compile(template);
|
|
|
|
return tpl({});
|
|
|
|
}
|
|
|
|
|
2024-06-04 17:28:12 +02:00
|
|
|
export function renderCommitMessage(
|
|
|
|
template: string,
|
2024-06-04 17:44:31 +02:00
|
|
|
flakeDotLockDir: string,
|
2024-06-04 17:28:12 +02:00
|
|
|
flakeDotLock: string,
|
|
|
|
): string {
|
2024-06-04 17:44:31 +02:00
|
|
|
return render(template, {
|
|
|
|
flake_dot_lock_dir: flakeDotLockDir,
|
|
|
|
flake_dot_lock: flakeDotLock,
|
|
|
|
});
|
2024-06-04 17:28:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function render(template: string, inputs: Record<string, string>): string {
|
|
|
|
const tpl = Handlebars.compile(template);
|
|
|
|
return tpl(inputs);
|
|
|
|
}
|