Skip to content

Commit

Permalink
[crater] Log whether or not auth token is present
Browse files Browse the repository at this point in the history
And also log the error kind  when we can't load a repo.
  • Loading branch information
cmyr committed Jan 17, 2025
1 parent 507391f commit 8d438c0
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions fontc_crater/src/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ fn run_crater_and_save_results(args: &CiArgs) -> Result<(), Error> {
super::try_create_dir(&args.out_dir)?;
}

log_if_auth_or_not();

let summary_file = args.out_dir.join(SUMMARY_FILE);
let mut prev_runs: Vec<RunSummary> = load_json_if_exists_else_default(&summary_file)?;
// todo: fontc_repo should be checked out by us, and have a known path
Expand Down Expand Up @@ -181,12 +183,13 @@ fn make_targets(cache_dir: &Path, repos: &[RepoInfo]) -> (Vec<Target>, BTreeMap<
let mut targets = Vec::new();
let mut repo_list = BTreeMap::new();
for repo in repos {
let Ok(iter) = repo.iter_configs(cache_dir) else {
log::warn!(
"error reading repo '{}'",
repo.repo_path(cache_dir).display()
);
continue;
let iter = match repo.iter_configs(cache_dir) {
Ok(iter) => iter,
Err(e) => {
let path = repo.repo_path(cache_dir);
log::warn!("error reading repo '{}': {e}", path.display());
continue;
}
};
for config_path in iter {
let config = match Config::load(&config_path) {
Expand Down Expand Up @@ -331,3 +334,13 @@ fn expect_binary_target(name: &str) -> PathBuf {
);
target
}

fn log_if_auth_or_not() {
match std::env::var("GITHUB_TOKEN") {
Ok(token) => log::info!(
"authenticated with token ending '{}'",
&token[token.len() - 10..]
),
Err(_) => log::warn!("no auth token set, private repos will be skipped"),
}
}

0 comments on commit 8d438c0

Please sign in to comment.