feat: allow running setup even if not allowed

code is pretty ugly for this and i just need it to run update-agefile
for every repo to have it display on cgit
This commit is contained in:
əlemi 2024-02-13 23:14:18 +01:00
parent 97dc8a0aee
commit 1f2999914b
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -24,6 +24,9 @@ struct TciConfig {
#[serde(default)]
allow_all: bool,
#[serde(default)]
run_setup_even_if_not_allowed: bool,
#[serde(default)]
setup: Vec<String>,
@ -72,7 +75,10 @@ fn tci(cfg: TciConfig) -> Result<(), Box<dyn std::error::Error>> {
let tci_script = git_config.get_str("tci.script").unwrap_or(".tci").to_string();
// check if CI is allowed
if !cfg.allow_all && !git_config.get_bool("tci.allow").unwrap_or(false) {
if !cfg.allow_all
&& !cfg.run_setup_even_if_not_allowed
&& !git_config.get_bool("tci.allow").unwrap_or(false)
{
return Ok(()); // we are in whitelist mode and this repo is not whitelisted
}
@ -82,6 +88,10 @@ fn tci(cfg: TciConfig) -> Result<(), Box<dyn std::error::Error>> {
shell_out(setup)?;
}
if !cfg.allow_all && !git_config.get_bool("tci.allow").unwrap_or(false) {
return Ok(()); // ewwww!!! ugly fix to allow running cgit update-agefile on every repo anyway
}
let res = tci_hook(&repo_path, &tci_script);
for cleanup in cfg.cleanup {