Skip to content

Commit 19f5a31

Browse files
committed
Use minimal ToolEntry instead of ParsedEntry to tolerate incomplete YAMLs
1 parent ac06d89 commit 19f5a31

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

ci/Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ci/pr-check/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ similar_names = "allow"
3333
too_many_lines = "allow"
3434

3535
[dependencies]
36-
render = { path = "../render" }
3736
anyhow = { workspace = true }
3837
askama = { workspace = true }
3938
chrono = { workspace = true }

ci/pr-check/src/main.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@
2121
use anyhow::{Context, Result, bail};
2222
use askama::Template;
2323
use chrono::{DateTime, Duration, Utc};
24-
use render::types::ParsedEntry;
2524
use serde::Deserialize;
2625
use std::collections::HashMap;
2726
use std::env;
2827
use std::path::{Path, PathBuf};
2928

29+
/// A minimal tool entry parsed from `data/tools/<name>.yml`.
30+
/// Only the fields needed for the contributing criteria check are required.
31+
#[derive(Debug, Deserialize)]
32+
struct ToolEntry {
33+
name: String,
34+
source: Option<String>,
35+
}
36+
3037
/// Response from `GET /repos/{owner}/{repo}`.
3138
#[derive(Debug, Deserialize)]
3239
struct RepoInfo {
@@ -282,7 +289,7 @@ fn parse_github_repo(url: &str) -> Option<(String, String)> {
282289
/// # Errors
283290
///
284291
/// Returns an error if the file cannot be read or parsed.
285-
fn read_tool(path: &Path) -> Result<ParsedEntry> {
292+
fn read_tool(path: &Path) -> Result<ToolEntry> {
286293
let f = std::fs::File::open(path).with_context(|| format!("Cannot open {}", path.display()))?;
287294
serde_yaml::from_reader(f).with_context(|| format!("Cannot parse {}", path.display()))
288295
}
@@ -293,7 +300,7 @@ fn read_tool(path: &Path) -> Result<ParsedEntry> {
293300
///
294301
/// Returns an error only for unexpected failures (network, auth). Missing
295302
/// criteria produce `CheckResult::Fail` values, not errors.
296-
async fn check_tool(client: &GithubClient, tool: &ParsedEntry) -> Result<ToolReport> {
303+
async fn check_tool(client: &GithubClient, tool: &ToolEntry) -> Result<ToolReport> {
297304
let source = tool.source.clone();
298305

299306
let gh_coords = source.as_deref().and_then(parse_github_repo);

0 commit comments

Comments
 (0)