1
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

View File

@ -3,7 +3,7 @@
set -euo pipefail set -euo pipefail
xgit() { 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)" NOW="$(date --utc +%Y-%m-%d-%H-%M)"
@ -25,8 +25,19 @@ nix flake lock --update-input nixpkgs
echo "[!] Commit changes" echo "[!] Commit changes"
xgit add flake.lock xgit add flake.lock
xgit commit -m "Update nixpkgs ${NOW}" || true 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}" echo "[!] Publish ${UPDATE_BRANCH}"
xgit push --set-upstream origin "${UPDATE_BRANCH}" xgit push --set-upstream origin "${UPDATE_BRANCH}"