From c80fafda16e00dc46f145cd4c211341c7667dbae Mon Sep 17 00:00:00 2001 From: Moritz 'e1mo' Fromm Date: Fri, 11 Aug 2023 20:46:59 +0200 Subject: [PATCH] Fix diff script when running on main --- .github/scripts/diff-hosts.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/scripts/diff-hosts.sh b/.github/scripts/diff-hosts.sh index 8d756ab..b9b7222 100755 --- a/.github/scripts/diff-hosts.sh +++ b/.github/scripts/diff-hosts.sh @@ -1,4 +1,11 @@ #!/usr/bin/env bash +# +debug="${ACTIONS_STEP_DEBUG-false}" +if $debug; then + set -x +else + set +x +fi # host_exists(flake, host) # Checks if ${flake}#nixosConfigurations.$host @@ -27,7 +34,7 @@ step_summary="${GITHUB_STEP_SUMMARY-/dev/null}" before_ref="${GITHUB_BASE_REF-main}" before_ref="origin/${before_ref/#refs\/heads\//}" -if [[ $GITHUB_REF == "target/refs/main" ]]; then +if [[ $GITHUB_REF == "target/refs/main" ]] || [[ $GITHUB_REF == "refs/heads/main" ]] || [[ $before_ref == "origin/" ]]; then # If triggered on main, compare with the previous commit before_ref="$(git log HEAD~1 -1 --format=format:"%H")" fi