From a30a7fa1b358358b7c7365b64c59a5daebbd84e3 Mon Sep 17 00:00:00 2001 From: Nick Novitski Date: Wed, 18 Oct 2023 22:09:38 -0700 Subject: [PATCH] feat: Don't add empty or already-set variables --- nix-develop-gha.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nix-develop-gha.sh b/nix-develop-gha.sh index 891a445..3e6950e 100755 --- a/nix-develop-gha.sh +++ b/nix-develop-gha.sh @@ -18,6 +18,11 @@ while IFS='=' read -r -d '' n v; do if [ "$n" == "PATH" ]; then continue fi + # Skip if the variable is already in the environment with the same + # value (treating unset and the empty string as identical states) + if [ "${!n:-}" == "$v" ]; then + continue + fi if (("$(wc -l <<<"$v")" > 1)); then delimiter=$(openssl rand -base64 18) if contains "$delimiter" "$v"; then