fix(ci): полный fetch в changes-job для мульти-коммитных пушей
quality / commitlint (push) Skipped
quality / changes (push) Successful in 7s
quality / docker-check (push) Skipped
quality / openapi (push) Successful in 52s
quality / web (push) Successful in 55s
quality / api (push) Failing after 32s
CD / quality (push) Failing after 2m32s
CD / publish (push) Skipped
quality / commitlint (push) Skipped
quality / changes (push) Successful in 7s
quality / docker-check (push) Skipped
quality / openapi (push) Successful in 52s
quality / web (push) Successful in 55s
quality / api (push) Failing after 32s
CD / quality (push) Failing after 2m32s
CD / publish (push) Skipped
push с несколькими коммитами: before_sha лежит глубже fetch-depth:2 и git diff падает bad object. Теперь checkout с полной историей; плюс защитный fallback на HEAD~1, если before_sha не резолвится
This commit is contained in:
@@ -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)"
|
||||
|
||||
Reference in New Issue
Block a user