diff --git a/.gitea/workflows/quality.yaml b/.gitea/workflows/quality.yaml index 861d22c..7768e52 100644 --- a/.gitea/workflows/quality.yaml +++ b/.gitea/workflows/quality.yaml @@ -46,7 +46,9 @@ jobs: - if: ${{ inputs.is_pull_request == false }} uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - fetch-depth: 2 + # Full history: before_sha may be many commits behind the new tip + # (multi-commit pushes) and must exist locally for git diff. + fetch-depth: 0 - id: detect name: Detect changed paths per module env: @@ -80,7 +82,14 @@ jobs: else after="${HEAD_SHA:-$(git rev-parse HEAD)}" before="$BEFORE_SHA" + # Guard: a stale/unresolvable before_sha must not fail the pipeline. if [ -n "$before" ] && [ "$before" != "0000000000000000000000000000000000000000" ]; then + if ! git cat-file -e "$before^{commit}" 2>/dev/null; then + echo "::warning::before_sha $before not resolvable, falling back to HEAD~1" + before="" + fi + fi + if [ -n "$before" ]; then FILES="$(git diff --name-only "$before" "$after")" elif git rev-parse --verify HEAD~1 >/dev/null 2>&1; then FILES="$(git diff --name-only HEAD~1 HEAD)"