1
0

pkgs/clerie-update-nixfiles: Add script to delete old update-nixfiles branches

This commit is contained in:
2025-04-07 21:37:47 +02:00
parent 8af0eb2386
commit 32ec59e303
3 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
{ pkgs, ... }:
pkgs.writeShellApplication {
name = "clerie-cleanup-branches";
text = builtins.readFile ./clerie-cleanup-branches.sh;
runtimeInputs = with pkgs; [
git
];
}

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Removes all branches from origin starting with updated-inputs-* except the 8 newest ones
git fetch origin --prune
git branch -r | sed "s/^ *//g" | grep "^origin/updated-inputs-" | sort | head -n -8 | sed "s/^origin\///g" | xargs git push origin --delete