Fix diff script when running on main

This commit is contained in:
Moritz 'e1mo' Fromm 2023-08-11 20:46:59 +02:00
parent e58bfa3c35
commit c80fafda16
No known key found for this signature in database
GPG key ID: 1D5D79A439E787F1

View file

@ -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