From 307e463c87b16e28957b7670a07c82792c399e02 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 17 Sep 2024 18:44:15 +0100 Subject: [PATCH] feat: collect useful environment vars --- src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index fbd2acd..6a3d21c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,9 +3,9 @@ use anyhow::Context; fn main() -> anyhow::Result<()> { println!("Forgejo TODO Checker!"); - let ci_repo = std::env::var("CI_REPO").context("CI_REPO")?; - let ci_repo_url = std::env::var("CI_REPO_URL").context("CI_REPO_URL")?; - let ci_forge_type = std::env::var("CI_FORGE_TYPE").context("CI_FORGE_TYPE")?; + let ci_repo = std::env::var("GITHUB_REPOSITORY").context("GITHUB_REPOSITORY")?; + let ci_server_url = std::env::var("GITHUB_SERVER_URL").context("GITHUB_SERVER_URL")?; + let ci_repo_url = format!("{ci_server_url}/{ci_repo}"); // optional arg for private repos let repo_token = std::env::var("REPO_TOKEN").ok(); @@ -16,7 +16,7 @@ fn main() -> anyhow::Result<()> { let issue = regex::Regex::new(r"( |)(\(|\(#)(?P\d+)(\))").context("issue regex")?; - println!("[ci_repo:{ci_repo}][ci_repo_url:{ci_repo_url}][ci_forge_type:{ci_forge_type}][repo_token:{repo_token:?}][prefix:{prefix}][issue:{issue}]"); + println!("[ci_repo:{ci_repo}][ci_repo_url:{ci_repo_url}][repo_token:{repo_token:?}][prefix:{prefix}][issue:{issue}]"); // list files in current directory to get a feel for what we have access to std::fs::read_dir(".")?