fix set -euo pipefail failure

This commit is contained in:
Elijah Duffy
2025-12-07 12:05:21 -08:00
parent 377e13c972
commit 984930fec4

View File

@@ -40,13 +40,18 @@ jobs:
exit 0
fi
# Determine changed files (PR vs push)
# Determine changed files (PR vs push vs manual dispatch)
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
elif [[ "${{ github.event_name }}" == "push" ]]; then
# For push events try to get the previous commit; fall back to empty
BASE_SHA="$(git rev-parse HEAD~1 2>/dev/null || true)"
HEAD_SHA="$(git rev-parse HEAD 2>/dev/null || true)"
else
BASE_SHA="$(git rev-parse HEAD~1 || echo '')"
HEAD_SHA="$(git rev-parse HEAD)"
# For workflow_dispatch and other events treat as "all files changed"
BASE_SHA=""
HEAD_SHA="$(git rev-parse HEAD 2>/dev/null || true)"
fi
if [[ -n "$BASE_SHA" ]]; then