This commit is contained in:
parent
a2a9a2ec68
commit
f2511d6737
2 changed files with 18 additions and 0 deletions
|
@ -5,3 +5,4 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
regex = "1.10"
|
||||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -1,6 +1,23 @@
|
||||||
|
use anyhow::Context;
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
println!("Forgejo TODO Checker!");
|
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")?;
|
||||||
|
|
||||||
|
// optional arg for private repos
|
||||||
|
let repo_token = std::env::var("REPO_TOKEN").ok();
|
||||||
|
|
||||||
|
// Regex to match a todo or fixme comment
|
||||||
|
let prefix = regex::Regex::new(r"(#|//)\s*(TODO|FIXME)").context("prefix regex")?;
|
||||||
|
// Regex to match the rest of the line to find an issue number
|
||||||
|
let issue =
|
||||||
|
regex::Regex::new(r"( |)(\(|\(#)(?P<ISSUE_NUMBER>\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}]");
|
||||||
|
|
||||||
// list files in current directory to get a feel for what we have access to
|
// list files in current directory to get a feel for what we have access to
|
||||||
std::fs::read_dir(".")?
|
std::fs::read_dir(".")?
|
||||||
.filter_map(Result::ok)
|
.filter_map(Result::ok)
|
||||||
|
|
Loading…
Reference in a new issue