1
0
forked from clan/clan-infra

Merge pull request 'Fix individual lockfile updates' (#235) from fix-individual into main

Reviewed-on: clan/clan-infra#235
This commit is contained in:
kenji 2024-08-20 13:06:29 +00:00
commit d6bf1ae1a9
2 changed files with 23 additions and 5 deletions

View File

@ -23,16 +23,25 @@ inputs=$(nix flake metadata --json | jq '.locks.nodes | keys[]' --raw-output | g
for input in $inputs;
do
target_branch="update-${input}"
echo "updating input: ${input}"
echo "checking out main"
echo "checking out: git checkout main"
git checkout main
git checkout -b "$target_branch"
echo "checking out: git checkout -b update-${input}"
export PR_TITLE="Automatic flake update - ${input} - ${today_minutes}"
export REMOTE_BRANCH="flake-update-${input}-${today}"
echo "action-ensure-tea-login"
action-ensure-tea-login
echo "action-flake-update: ${input}"
action-flake-update "$input"
echo "action-create-pr"
action-create-pr --assignees clan-bot
echo "check diff"
if git diff --quiet main.."$target_branch" --;then
echo "No lockfile changes for input: ${input}"
else
echo "action-create-pr"
action-create-pr --assignees clan-bot
fi
done

View File

@ -1,7 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
COMMIT_MSG="update flake lock - $(date --iso-8601=minutes)"
NIX_VERSION=$(nix --version)
echo "Nix version: $NIX_VERSION"
if [ -z "${*}" ];then
COMMIT_MSG="update flake lock - $(date --iso-8601=minutes)"
nix --experimental-features "nix-command flakes" \
flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG" "$@"
flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
else
# Support for ancient nix versions
COMMIT_MSG="update flake lock - ${*} - $(date --iso-8601=minutes)"
nix --experimental-features "nix-command flakes" \
flake lock --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG" --update-input "${@}"
fi