print the change warnings once for per id

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2023-11-11 16:20:06 +03:00
parent 1db4b12494
commit 056d4e4c51

View file

@ -109,11 +109,19 @@ fn check_version(config: &Config) -> Option<String> {
}
let latest_config_id = CONFIG_CHANGE_HISTORY.last().unwrap();
let warned_id_path = config.out.join("bootstrap").join(".last-warned-change-id");
if let Some(id) = config.change_id {
if &id == latest_config_id {
return None;
}
if let Ok(last_warned_id) = fs::read_to_string(&warned_id_path) {
if id.to_string() == last_warned_id {
return None;
}
}
let change_links: Vec<String> = find_recent_config_change_ids(id)
.iter()
.map(|id| format!("https://github.com/rust-lang/rust/pull/{id}"))
@ -132,6 +140,8 @@ fn check_version(config: &Config) -> Option<String> {
msg.push_str(&format!(
"update `config.toml` to use `change-id = {latest_config_id}` instead"
));
t!(fs::write(warned_id_path, id.to_string()));
}
} else {
msg.push_str("WARNING: The `change-id` is missing in the `config.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.\n");