Parse issue list

This commit is contained in:
Rahix 2026-03-01 15:47:42 +01:00
parent 1db4778dc4
commit b3e0270e38
5 changed files with 56 additions and 29 deletions

View file

@ -15,17 +15,6 @@ pub struct Context {
pub repo_auth_url: url::Url,
}
impl std::fmt::Debug for Context {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Context")
.field("owner", &self.owner)
.field("repo", &self.repo)
.field("repo_url", &self.repo_url.to_string())
.field("repo_auth_url", &"<redacted>")
.finish()
}
}
impl Context {
pub fn new_from_env_or_dev_fallback() -> anyhow::Result<Self> {
if std::env::var("CI").is_ok() {
@ -51,7 +40,11 @@ impl Context {
let config: DevEnvironment =
serde_json::de::from_reader(f).context("Failed to parse dev environment")?;
Self::new(&config.dev_token, &config.server_url, &config.repo_with_owner)
Self::new(
&config.dev_token,
&config.server_url,
&config.repo_with_owner,
)
}
fn new(token: &str, server_url: &str, repo_with_owner: &str) -> anyhow::Result<Self> {
@ -84,6 +77,17 @@ impl Context {
}
}
impl std::fmt::Debug for Context {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Context")
.field("owner", &self.owner)
.field("repo", &self.repo)
.field("repo_url", &self.repo_url.to_string())
.field("repo_auth_url", &"<redacted>")
.finish()
}
}
fn get_env_value(key: &str) -> anyhow::Result<String> {
std::env::var(key).with_context(|| format!("Missing ${key} environment variable"))
}