Fix diff script when running on main
This commit is contained in:
parent
e58bfa3c35
commit
c80fafda16
1 changed files with 8 additions and 1 deletions
9
.github/scripts/diff-hosts.sh
vendored
9
.github/scripts/diff-hosts.sh
vendored
|
@ -1,4 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
debug="${ACTIONS_STEP_DEBUG-false}"
|
||||||
|
if $debug; then
|
||||||
|
set -x
|
||||||
|
else
|
||||||
|
set +x
|
||||||
|
fi
|
||||||
|
|
||||||
# host_exists(flake, host)
|
# host_exists(flake, host)
|
||||||
# Checks if ${flake}#nixosConfigurations.$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="${GITHUB_BASE_REF-main}"
|
||||||
before_ref="origin/${before_ref/#refs\/heads\//}"
|
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
|
# If triggered on main, compare with the previous commit
|
||||||
before_ref="$(git log HEAD~1 -1 --format=format:"%H")"
|
before_ref="$(git log HEAD~1 -1 --format=format:"%H")"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue