feat(github): Add basic templating support for Github Actions

This commit is contained in:
Gerald Pinder 2023-12-28 17:59:37 -05:00
parent 3b07758709
commit 7ce70480bf
2 changed files with 15 additions and 1 deletions

View file

@ -1,6 +1,6 @@
use std::{
collections::HashMap,
fs,
env, fs,
path::{Path, PathBuf},
process,
};
@ -164,6 +164,16 @@ impl TemplateCommand {
},
);
debug!("Registering function `running_gitlab_actions`");
tera.register_function(
"running_gitlab_actions",
|_: &HashMap<String, tera::Value>| -> tera::Result<tera::Value> {
trace!("tera fn running_gitlab_actions()");
Ok(env::var("GITHUB_ACTIONS").is_ok_and(|e| e == "true").into())
},
);
Ok((tera, context))
}
}