// use crate::model::Config; use crate::patterns::{issue_pattern, marker_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 { 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")?) .prefix_pattern(marker_pattern()?) .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!("Prefix: {}", config.prefix_pattern())); printer.println(format!("Issues: {}", config.issue_pattern())); printer.println(""); Ok(config) }