forgejo-todo-checker/src/init.rs
Paul Campbell a7e6ca4172
All checks were successful
Test / checks (map[name:nightly]) (push) Successful in 3m58s
Test / checks (map[name:stable]) (push) Successful in 1m24s
fix: Only look for issue number within the comment
Closes kemitix/forgejo-todo-checker#7
2024-09-22 11:06:54 +01:00

29 lines
922 B
Rust

//
use crate::model::Config;
use crate::patterns::issue_pattern;
use crate::printer::Printer;
use anyhow::{Context, Result};
use kxio::fs;
use kxio::network::Network;
pub fn init_config(printer: &impl Printer, net: Network) -> Result<Config> {
let config = Config::builder()
.net(net)
.fs(fs::new(
std::env::var("GITHUB_WORKSPACE")
.context("GITHUB_WORKSPACE")?
.into(),
))
.repo(std::env::var("GITHUB_REPOSITORY").context("GITHUB_REPOSITORY")?)
.server(std::env::var("GITHUB_SERVER_URL").context("GITHUB_SERVER_URL")?)
.issue_pattern(issue_pattern()?)
.maybe_auth_token(std::env::var("REPO_TOKEN").ok())
.build();
printer.println("");
printer.println(format!("Repo : {}", config.repo()));
printer.println(format!("Regex: {}", config.issue_pattern()));
printer.println("");
Ok(config)
}