rustc_artifacts/
lib.rs

1use serde_derive::Deserialize;
2
3#[derive(Debug, Clone, Deserialize)]
4pub struct Commit {
5    pub sha: String,
6    pub parent_sha: String,
7    /// This is the pull request which this commit merged in.
8    #[serde(default)]
9    pub pr: Option<u32>,
10    pub time: chrono::DateTime<chrono::Utc>,
11}
12
13/// This provides the master-branch Rust commits which should have accompanying
14/// bors artifacts available.
15///
16/// The first commit returned (at index 0) is the most recent, the last is the
17/// oldest.
18///
19/// Specifically, this is the last 168 days of bors commits.
20///
21/// Note that this does not contain try commits today, so it should not be used
22/// to validate hashes or expand them generally speaking. This may also change
23/// in the future.
24pub async fn master_commits() -> Result<Vec<Commit>, Box<dyn std::error::Error + Sync + Send>> {
25    let response = reqwest::get("https://triage.rust-lang.org/bors-commit-list").await?;
26    Ok(response.json().await?)
27}