diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7fa1489..affa8b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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