diff --git a/.github/workflows/supported-refs.yaml b/.github/workflows/allowed-refs.yaml similarity index 100% rename from .github/workflows/supported-refs.yaml rename to .github/workflows/allowed-refs.yaml diff --git a/src/supported_refs.rs b/src/supported_refs.rs deleted file mode 100644 index 2e14692..0000000 --- a/src/supported_refs.rs +++ /dev/null @@ -1,43 +0,0 @@ -use crate::error::FlakeCheckerError; - -use serde::Deserialize; - -const SUPPORTED_REFS_URL: &str = "https://prometheus.nixos.org/api/v1/query?query=channel_revision"; - -#[derive(Deserialize)] -struct Response { - data: Data, -} - -#[derive(Deserialize)] -struct Data { - result: Vec, -} - -#[derive(Deserialize)] -struct DataResult { - metric: Metric, -} - -#[derive(Deserialize)] -struct Metric { - channel: String, - current: String, -} - -pub(crate) fn check(supported_refs: Vec) -> Result { - Ok(get()? == supported_refs) -} - -pub(crate) fn get() -> Result, FlakeCheckerError> { - let officially_supported: Vec = reqwest::blocking::get(SUPPORTED_REFS_URL)? - .json::()? - .data - .result - .iter() - .filter(|res| res.metric.current == "1") - .map(|res| res.metric.channel.clone()) - .collect(); - - Ok(officially_supported) -}