mirror of
https://git.alemi.dev/tci.git
synced 2024-11-14 04:39:19 +01:00
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:
parent
97dc8a0aee
commit
1f2999914b
1 changed files with 11 additions and 1 deletions
12
src/main.rs
12
src/main.rs
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue