1
0
Fork 0

pkgs/nixfiles: nixfiles-updated-inputs check if update changes anything

This commit is contained in:
clerie 2024-03-17 15:42:14 +01:00
parent 343ce80661
commit 059aaa760b
1 changed files with 12 additions and 1 deletions

View File

@ -3,7 +3,7 @@
set -euo pipefail
xgit() {
git -c "user.name=Flake Update Bot" -c "user.email=flake-update-bot@clerie.de" "$@"
git -c "user.name=Flake Update Bot" -c "user.email=flake-update-bot@clerie.de" -c "core.pager=cat" "$@"
}
NOW="$(date --utc +%Y-%m-%d-%H-%M)"
@ -25,8 +25,19 @@ nix flake lock --update-input nixpkgs
echo "[!] Commit changes"
xgit add flake.lock
xgit commit -m "Update nixpkgs ${NOW}" || true
xgit diff --name-status origin/updated-inputs "${UPDATE_BRANCH}"
echo "[!] biep"
if xgit diff --quiet origin/updated-inputs "${UPDATE_BRANCH}"
then
echo "[!] Nothing changed, removing branch"
xgit branch -D "${UPDATE_BRANCH}"
exit 0
fi
echo "[!] Publish ${UPDATE_BRANCH}"
xgit push --set-upstream origin "${UPDATE_BRANCH}"