Get allowed branches programmatically

This commit is contained in:
Luc Perkins 2023-05-22 17:38:05 +02:00
parent 729f7d10dd
commit 6398fd8684
No known key found for this signature in database
GPG Key ID: 4F102D0C16E232F2
4 changed files with 13 additions and 1 deletions

View File

@ -14,4 +14,5 @@ jobs:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v2
- run: |
nix develop -c get-refs
nix develop -c cargo run -- ./flake.bad.lock

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ result
# Generated
summary.md
src/policy.json

View File

@ -10,6 +10,13 @@
inputs.rust-overlay.overlays.default
(final: prev: {
rustToolchain = prev.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
get-refs = prev.writeScriptBin "get-refs" ''
${prev.curl}/bin/curl --fail --silent \
'https://monitoring.nixos.org/prometheus/api/v1/query?query=channel_revision' \
| ${prev.jq}/bin/jq -r '{ "allowed_branches": [(.data.result[] | select(.metric.current == "1") | .metric.channel)] | sort, "max_days": 30 }' \
> src/policy.json
'';
})
];
systems = [ "aarch64-linux" "aarch64-darwin" "x86_64-linux" "x86_64-darwin" ];
@ -26,6 +33,9 @@
cargo-edit
cargo-watch
rust-analyzer
# Helpers
get-refs
];
};
});

View File

@ -1,5 +1,5 @@
{
"allowed_refs": [
"allowed_branches": [
"nixos-22.11",
"nixos-22.11-small",
"nixos-unstable",