gh: only run migration when required

This commit is contained in:
Harsh Shandilya 2024-01-13 05:32:44 +05:30 committed by GitHub
parent 7403ed4980
commit 0912d26b30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -137,7 +137,7 @@ in {
home.activation.migrateGhAccounts =
let ghHosts = "${config.xdg.configHome}/gh/hosts.yml";
in hm.dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] ''
if [[ ! -L "${ghHosts}" && -f "${ghHosts}" ]]; then
if [[ ! -L "${ghHosts}" && -f "${ghHosts}" && $(grep --invert-match --quiet '^version:' ${ghHosts}) ]]; then
(
TMP_DIR=$(mktemp -d)
trap "rm --force --recursive $TMP_DIR" EXIT